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

timegm should be called with 4-digit year #16431

Closed
p5pRT opened this issue Feb 22, 2018 · 9 comments
Closed

timegm should be called with 4-digit year #16431

p5pRT opened this issue Feb 22, 2018 · 9 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Feb 22, 2018

Migrated from rt.perl.org#132897 (status was 'open')

Searchable as RT132897$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 22, 2018

From perlbugbmw@lsmod.de

Created by perlbugbmw@lsmod.de

timegm should be called with 4-digit year
to avoid ambiguities in Time​::Local with 2-digit years
that cause a bug in 2020

note​: while this is only documentation, I found that some people do RTFM
and included this snippet in their module
e.g. Parse-Win32Registry, HTTP-Cookies and HTTP-Message

please review/test/merge this fix​:

--- perl-5.26.1.orig/pod/perlport.pod
+++ perl-5.26.1/pod/perlport.pod
@​@​ -673 +673 @​@​
- my $offset = timegm(0, 0, 0, 1, 0, 70);
+ my $offset = timegm(0, 0, 0, 1, 0, 1970);

Perl Info

Flags:
    category=docs
    severity=medium

This perlbug was built using Perl 5.18.2 - Fri Nov 24 17:17:29 UTC 2017
It is being executed now by  Perl 5.18.2 - Fri Nov 24 17:15:01 UTC 2017.

Site configuration information for perl 5.18.2:

Configured by abuild at Fri Nov 24 17:15:01 UTC 2017.

Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
   
  Platform:
    osname=linux, osvers=4.4.92-31-default, archname=x86_64-linux-thread-multi
    uname='linux build70 4.4.92-31-default #1 smp sun oct 22 06:56:24 utc 2017 (1d80e8a) x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0 5.18.1/x86_64-linux-thread-multi 5.18.1'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector'
    ccversion='', gccversion='4.8.5', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
    libpth=/lib64 /usr/lib64 /usr/local/lib64
    libs=-lm -ldl -lcrypt -lpthread
    perllibs=-lm -ldl -lcrypt -lpthread
    libc=/lib64/libc-2.22.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.22'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector'

Locally applied patches:
    


@INC for perl 5.18.2:
    /home/bernhard/perl5/lib/perl5
    /home/bernhard/perl5/lib/perl5
    /usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.18.2
    /usr/lib/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.18.2
    /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi
    /usr/lib/perl5/5.18.2
    /usr/lib/perl5/site_perl


Environment for perl 5.18.2:
    HOME=/home/bernhard
    LANG=en_US.utf8
    LANGUAGE (unset)
    LC_CTYPE=en_DK.utf8
    LC_TIME=en_DK.utf8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/bernhard/code/cvs/reproducible/reproducibleopensuse:/home/bernhard/perl5/bin:/home/bernhard/code/cvs/reproducible/reproducibleopensuse:/home/bernhard/perl5/bin:/home/bernhard/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL5LIB=/home/bernhard/perl5/lib/perl5:/home/bernhard/perl5/lib/perl5
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/home/bernhard/perl5:/home/bernhard/perl5
    PERL_MB_OPT=--install_base "/home/bernhard/perl5"
    PERL_MM_OPT=INSTALL_BASE=/home/bernhard/perl5
    SHELL=/bin/bash

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 22, 2018

From @jkeenan

On Thu, 22 Feb 2018 10​:17​:25 GMT, perlbugbmw@​lsmod.de wrote​:

This is a bug report for perl from perlbugbmw@​lsmod.de,
generated with the help of perlbug 1.39 running under perl 5.18.2.

-----------------------------------------------------------------
[Please describe your issue here]

timegm should be called with 4-digit year
to avoid ambiguities in Time​::Local with 2-digit years
that cause a bug in 2020

note​: while this is only documentation, I found that some people do
RTFM
and included this snippet in their module
e.g. Parse-Win32Registry, HTTP-Cookies and HTTP-Message

please review/test/merge this fix​:

--- perl-5.26.1.orig/pod/perlport.pod
+++ perl-5.26.1/pod/perlport.pod
@​@​ -673 +673 @​@​
- my $offset = timegm(0, 0, 0, 1, 0, 70);
+ my $offset = timegm(0, 0, 0, 1, 0, 1970);

Pinging Dave Rolsky, upstream maintainer for Time​::Local​:

Dave, okay to make this change in 'perlport'?

Thank you very much.
Jim Keenan

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Feb 22, 2018

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

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jan 24, 2019

From bitcardbmw@lsmod.de

On Thu, 22 Feb 2018 06​:58​:35 -0800, jkeenan wrote​:

On Thu, 22 Feb 2018 10​:17​:25 GMT, perlbugbmw@​lsmod.de wrote​:

--- perl-5.26.1.orig/pod/perlport.pod
+++ perl-5.26.1/pod/perlport.pod
@​@​ -673 +673 @​@​
- my $offset = timegm(0, 0, 0, 1, 0, 70);
+ my $offset = timegm(0, 0, 0, 1, 0, 1970);

Pinging Dave Rolsky, upstream maintainer for Time​::Local​:

Dave, okay to make this change in 'perlport'?

The Time​::Local docs said, it should be this way, because 2-digit dates reference the rolling "current century"

@bmwiedemann

This comment has been minimized.

Copy link
Contributor

@bmwiedemann bmwiedemann commented Dec 23, 2019

This is still broken in blead:

When calculating specific times, such as for tests in time or date modules,
it may be appropriate to calculate an offset for the epoch.

    use Time::Local qw(timegm);
    my $offset = timegm(0, 0, 0, 1, 0, 70);

We do not want rolling century in that case. The epoch is always 1970, and not 2070, just because it is 2020 now.

bmwiedemann added a commit to bmwiedemann/perl5 that referenced this issue Dec 23, 2019
and not meant to be interpreted as 2070 because of rolling century.

Fixes Perl#16431
bmwiedemann added a commit to bmwiedemann/perl5 that referenced this issue Dec 23, 2019
and not meant to be interpreted as 2070 because of rolling century.

Fixes Perl#16431
@Grinnz

This comment has been minimized.

Copy link
Contributor

@Grinnz Grinnz commented Dec 23, 2019

This should be changed, see http://blogs.perl.org/users/grinnz/2019/07/the-timelocal-trap.html for more info

@jkeenan

This comment has been minimized.

Copy link
Contributor

@jkeenan jkeenan commented Dec 28, 2019

From @jkeenan

On Thu, 22 Feb 2018 10​:17​:25 GMT, perlbugbmw@​lsmod.de wrote​:

This is a bug report for perl from perlbugbmw@​lsmod.de,
generated with the help of perlbug 1.39 running under perl 5.18.2.

[Please describe your issue here]
timegm should be called with 4-digit year
to avoid ambiguities in Time​::Local with 2-digit years
that cause a bug in 2020
note​: while this is only documentation, I found that some people do
RTFM
and included this snippet in their module
e.g. Parse-Win32Registry, HTTP-Cookies and HTTP-Message
please review/test/merge this fix​:
--- perl-5.26.1.orig/pod/perlport.pod
+++ perl-5.26.1/pod/perlport.pod
@​@​ -673 +673 @​@​

  • my $offset = timegm(0, 0, 0, 1, 0, 70);
  • my $offset = timegm(0, 0, 0, 1, 0, 1970);

Pinging Dave Rolsky, upstream maintainer for Time​::Local​:

Dave, okay to make this change in 'perlport'?

Thank you very much.
Jim Keenan

--
James E Keenan (jkeenan@​cpan.org)

@autarch Can you comment on this proposed change to pod/perlport.pod?

Thank you very much.
Jim Keenan

@autarch

This comment has been minimized.

Copy link
Contributor

@autarch autarch commented Dec 28, 2019

+1 on this change.

@jkeenan

This comment has been minimized.

Copy link
Contributor

@jkeenan jkeenan commented Dec 28, 2019

+1 on this change.

Thanks for the review. Pushed to blead in commit 57d341f. Closing ticket.

Thank you very much.
Jim Keenan

@jkeenan jkeenan closed this Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.