Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.84k stars 524 forks source link

posix/mac osx #5036

Closed p5pRT closed 20 years ago

p5pRT commented 22 years ago

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

Searchable as RT8525$

p5pRT commented 22 years ago

From cdevers@cis.usouthal.edu

Created by cdevers@cis.usouthal.edu

The following script exposes an apparent POSIX bug in the default version of Perl on MacOSX (10.1.2)​:

  #!/usr/bin/perl -w  
  use strict;   use POSIX qw(strftime);  
  my $fmt = '%Z';   my @​now = localtime();   my $posix = strftime($fmt\, @​now);   my $sys = `date '+%Z'`;   chomp $sys;  
  print "POSIX timezone tag seems broken​:\n" unless $posix eq $sys;  
  print "System date command thinks the timezone is $sys.\n";   print "POSIX thinks the timezone is $posix.\n";  
Running this script on OSX gives the following result​:

  % ./posixtest.pl   POSIX timezone tag seems broken​:   System date command thinks the timezone is EST.   POSIX thinks the timezone is B???q?2X.   %

Note that the characters above aren't actually question marks\, but unprintable characters which I haven't tried to decode. The same script\, when run on Solaris\, Debian\, or FreeBSD\, correctly produces​:

  % ./posixtest.pl   System date command thinks the timezone is CST.   POSIX thinks the timezone is CST.   %

It has also been brought to my attention that POSIX​::access doesn't work correctly either\, but I don't have sample code to expose that. It is possible that the two errors are related. Also note that I'm (so far) only seeing the date format error with %Z; other formatting codes I've tested so far seem to be working normally.

Perl Info ``` Flags: category=library severity=medium Site configuration information for perl v5.6.0: Configured by root at Sun Sep 2 17:20:42 PDT 2001. Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=darwin, osvers=1.4, archname=darwin uname='darwin law 1.4 darwin kernel version 1.3: sun jul 22 16:20:35 pdt 2001; aramesh:buildobjrelease_ppc power macintosh powerpc ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cc', optimize='-O3', gccversion=Apple devkit-based CPP 6.0 cppflags='-g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing' ccflags ='-g -pipe -pipe -fno-common -no-cpp-precomp -flat_namespace -DHAS_TELLDIR_PROTOTYPE -fno-strict-aliasing' stdchar='char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/usr/lib libs=-lm -lc libc=/System/Library/Frameworks/System.framework/System, so=dylib, useshrplib=true, libperl=libperl.dylib Dynamic Linking: dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-bundle -flat_namespace -undefined suppress' Locally applied patches: @INC for perl v5.6.0: /System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin /Library/Perl /Library/Perl /Network/Library/Perl/darwin /Network/Library/Perl /Network/Library/Perl . Environment for perl v5.6.0: DYLD_LIBRARY_PATH (unset) HOME=/Users/chris LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/X11R6/bin:/sw/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sw/sbin:/Users/chris/bin/powerpc-apple-darwin:/Users/chris/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/X11R6/bin PERL_BADLANG (unset) SHELL=/bin/tcsh ```