Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX::strftime() breaks on Windows Vista if first arg is 60 #8992

Closed
p5pRT opened this issue Aug 12, 2007 · 6 comments
Closed

POSIX::strftime() breaks on Windows Vista if first arg is 60 #8992

p5pRT opened this issue Aug 12, 2007 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 12, 2007

Migrated from rt.perl.org#44589 (status was 'resolved')

Searchable as RT44589$

@p5pRT
Copy link
Author

p5pRT commented Aug 12, 2007

From @sisyphus

To​: perlbug@​perl.org
Subject​: POSIX​::strftime() breaks on Windows Vista if first arg is 60
Reply-To​: sisyphus@​cpan.org
Message-Id​: <5.8.8_3112_1186920891@​desktop2>

This is a bug report for perl from sisyphus@​cpan.org,
generated with the help of perlbug 1.35 running under perl v5.8.8.

On Windows Vista Business (64-bit), AMD64 processor I get​:


C​:\_32\pscrpt>type try.pl
use strict;
use warnings;
use POSIX;

my $expect = "Thu Feb 29 00​:00​:60 1996 060";
my $got = POSIX​::strftime("%a %b %d %H​:%M​:%S %Y %j", 60,0,-24, 30,1,96);
print $expect, "\n", $got, "\n";

C​:\_32\pscrpt>perl try.pl
Thu Feb 29 00​:00​:60 1996 060
%a %b %d %H​:%M​:%S %Y %j


That's a copy'n'paste of what happens when running ActiveState's x86 build
822 (5.8.8).
Exactly the same result for ActiveState's x64 build 822 (5.8.8) and
MinGW-built perl 5.9.5.
(Hence the ext/POSIX/t/posix.t test reports a failure for test 23 when
building perl 5.9.5 on Vista.)

With MinGW-built perl 5.8.8 the script just hangs, producing no output at
all.

On Windows 2000 $got eq $expect (for both perl 5.8.8 and 5.9.5 - ActiveState
and MinGW builds).

I guess that Vista and 2000 are using different runtimes.


Flags​:
  category=core
  severity=medium


Site configuration information for perl v5.8.8​:

Configured by SYSTEM at Tue Jul 31 19​:34​:29 2007.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration​:
  Platform​:
  osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags
='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE
-DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing',
  optimize='-O2',
  cppflags='-DWIN32'
  ccversion='', gccversion='3.4.5 (mingw32 special)', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='g++', ldflags ='-L"C​:\_32\ap822\lib\CORE"'
  libpth=\lib
  libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32
-lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32
-lodbccp32 -lmsvcrt
  perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32
-lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32
-lodbccp32 -lmsvcrt
  libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl58.lib
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-mdll -L"C​:\_32\ap822\lib\CORE"'

Locally applied patches​:
  ACTIVEPERL_LOCAL_PATCHES_ENTRY
  Iin_load_module moved for compatibility with build 806
  Avoid signal flag SA_RESTART for older versions of HP-UX
  PerlEx support in CGI​::Carp
  Less verbose ExtUtils​::Install and Pod​::Find
  Patch for CAN-2005-0448 from Debian with modifications
  Rearrange @​INC so that 'site' is searched before 'perl'
  Partly reverted 24733 to preserve binary compatibility
  MAINT31223 plus additional changes
  31490 Problem bootstraping Win32CORE
  31324 Fix DynaLoader​::dl_findfile() to locate .so files again
  31214 Win32​::GetLastError fails when first called
  31211 Restore Windows NT support
  31188 Problem killing a pseudo-forked child on Win32
  29732 ANSIfy the PATH environment variable on Windows
  27527,29868 win32_async_check() can loop indefinitely
  26970 Make Passive mode the default for Net​::FTP
  26379 Fix alarm() for Windows 2003
  24699 ICMP_UNREACHABLE handling in Net​::Ping


@​INC for perl v5.8.8​:
  C​:/_32/ap822/site/lib
  C​:/_32/ap822/lib
  .


Environment for perl v5.8.8​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\Program Files\Windows
NT\Accessories;C​:\_32\third_party_app;C​:\GNUWin32\bin;C​:\_32\dmake;C​:\_32\MinGW\bin;C​:\_32\ap822\bin;c​:\ruby\bin;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\batch;C​:\_32\msys\1.0\bin
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Aug 13, 2007

From @steve-m-hay

Sisyphus" (via RT) wrote​:

# New Ticket Created by "Sisyphus"
# Please include the string​: [perl #44589]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=44589 >

That's a copy'n'paste of what happens when running ActiveState's x86
build 822 (5.8.8).
Exactly the same result for ActiveState's x64 build 822 (5.8.8) and
MinGW-built perl 5.9.5.
(Hence the ext/POSIX/t/posix.t test reports a failure for test 23 when
building perl 5.9.5 on Vista.)

With MinGW-built perl 5.8.8 the script just hangs, producing no
output at
all.

That's because 5.8.8 doesn't contain #29350, which fixed an infinite
loop bug in POSIX​::strftime(). The ActivePerl builds don't hang because
they contain numerous core changes (and others) on top of the official
5.8.8, including #29350.

On Windows 2000 $got eq $expect (for both perl 5.8.8 and 5.9.5 -
ActiveState
and MinGW builds).

I guess that Vista and 2000 are using different runtimes.

I get the same result testing on XP (OK) and Vista (not OK).

They do indeed seem to be using different CRTs​: looking at the versions
of MSVCRT.DLL on the two OSes I see​:

XP SP2​: 7.0.2600.2180
Vista​: 7.0.6000.16386

I guess the newer CRT contains some of the changes that are in VC8's
CRT, including this change to strftime().

I'll change the test to skip on Vista (or higher) as well as for VC8 (or
higher). I wonder if subsequent service packs for XP might also update
the CRT to a later version containing the strftime() change too. If that
happens then I guess we'll have to start looking at the DLL versions
returned by Win32​::GetFileVersion() but there's no need for now.

@p5pRT
Copy link
Author

p5pRT commented Aug 13, 2007

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Aug 15, 2007

From @steve-m-hay

Now fixed in bleadperl by change #31721.

@p5pRT
Copy link
Author

p5pRT commented Aug 15, 2007

@steve-m-hay - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Aug 15, 2007
@p5pRT
Copy link
Author

p5pRT commented Aug 15, 2007

From @smpeters

On Mon, Aug 13, 2007 at 10​:19​:10AM +0100, Steve Hay wrote​:

Sisyphus" (via RT) wrote​:

# New Ticket Created by "Sisyphus"
# Please include the string​: [perl #44589]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=44589 >

That's a copy'n'paste of what happens when running ActiveState's x86
build 822 (5.8.8).
Exactly the same result for ActiveState's x64 build 822 (5.8.8) and
MinGW-built perl 5.9.5.
(Hence the ext/POSIX/t/posix.t test reports a failure for test 23 when
building perl 5.9.5 on Vista.)

With MinGW-built perl 5.8.8 the script just hangs, producing no
output at
all.

That's because 5.8.8 doesn't contain #29350, which fixed an infinite
loop bug in POSIX​::strftime(). The ActivePerl builds don't hang because
they contain numerous core changes (and others) on top of the official
5.8.8, including #29350.

On Windows 2000 $got eq $expect (for both perl 5.8.8 and 5.9.5 -
ActiveState
and MinGW builds).

I guess that Vista and 2000 are using different runtimes.

I get the same result testing on XP (OK) and Vista (not OK).

They do indeed seem to be using different CRTs​: looking at the versions
of MSVCRT.DLL on the two OSes I see​:

XP SP2​: 7.0.2600.2180
Vista​: 7.0.6000.16386

I guess the newer CRT contains some of the changes that are in VC8's
CRT, including this change to strftime().

I'll change the test to skip on Vista (or higher) as well as for VC8 (or
higher). I wonder if subsequent service packs for XP might also update
the CRT to a later version containing the strftime() change too. If that
happens then I guess we'll have to start looking at the DLL versions
returned by Win32​::GetFileVersion() but there's no need for now.

Looking at MSDN, the documention for %S in strftime() is listed as

  Second as decimal number (00 - 59)

while POSIX gives

  Replaced by the second as a decimal number [00,60].

So it appears that Microsoft has simply changed its functionality to match
what its documentation has been since at least .NET 1.1.

Steve Peters
steve@​fisharerojo.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant