Bug 18879

Summary: Y2K bug in perl
Product: [Retired] Red Hat Linux Reporter: braun
Component: perlAssignee: Crutcher Dunnavant <crutcher>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-11 10:35:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description braun 2000-10-11 10:22:30 UTC
There is a problem with the array returned by gmtime in perl (RedHat 6.2 +
latest perl).
The following example prints year 100:

Script started on Wed Oct 11 12:07:24 2000
[braun@bastheth braun]$ cat ptime.pl
#!/usr/bin/perl

( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst ) = gmtime (time());

printf (" Current date is %2d/%2d/%4d .\n",$mon + 1, $mday, $year); 
[braun@bastheth braun]$ ./ptime.pl ; date
 Current date is 10/11/ 100 .
Wed Oct 11 12:07:45 MEST 2000
[braun@bastheth braun]$ rpm -q perl
perl-5.00503-12
[braun@bastheth braun]$ exit

Script done on Wed Oct 11 12:08:09 2000

Comment 1 braun 2000-10-11 10:35:38 UTC
Ok, it could be that $year is the number of years since 1900 (i. e. not a bug).
I found similar code in mirror-2.9 (dateconv.pl). Mirror actually sends mails
with year 100 in its body.

Mirrored rh70updates (ftp.gmd.de:/mirrors/redhat.com/updates/7.0 ->
/home/ftp/pub/linux/RedHat/updates/7.0) RedHat Linux Updates @ 11 Oct 100 10:35
Got SRPMS/usermode-1.36-3.src.rpm 59209 1


Comment 2 Crutcher Dunnavant 2000-10-11 14:40:22 UTC
Not a bug, perl documents this behaviour,

from 'perldoc -f gmtime':
  Note that the $year element is not simply the last
  two digits of the year.  If you assume it is, then
  you create non-Y2K-compliant programs--and you
  wouldn't want to do that, would you?

  The proper way to get a complete 4-digit year is
  simply:

  year += 1900;