Closed p5pRT closed 20 years ago
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.
Migrated from rt.perl.org#8525 (status was 'resolved')
Searchable as RT8525$