Bug #6571

Time.mktime Y2K38 problem on 1.9.3p125 i386-mingw32

Added by Martin Bosslet almost 2 years ago. Updated about 1 year ago.

[ruby-core:45552]
Status:Assigned
Priority:Normal
Assignee:Martin Bosslet
Category:ext
Target version:next minor
ruby -v:ruby 1.9.3p125 (2012-02-16) [i386-mingw32] Backport:

Description

=begin
This came up in https://bugs.ruby-lang.org/issues/6122.

(({Time.mktime(2038, 1, 19, 11, 14, 8)})) failed. To my understanding, 32 bit Time
issues shouldn't occur in 1.9.3? I'm assigning this to Luis, maybe he knows
about this and what to do? Please feel free to reassign back to me.
=end


Related issues

Related to ruby-trunk - Bug #6122: OpenSSL::PKCS7 verify Closed 03/07/2012

History

#1 Updated by Nobuyoshi Nakada almost 2 years ago

  • Description updated (diff)
  • Status changed from Assigned to Feedback
  • Target version changed from 2.0.0 to 1.9.3

I can't reproduce it with 1.9.3p216, in JST and PST.
What are the failure message and your timezone?

#2 Updated by Akira Tanaka almost 2 years ago

2012/6/11 MartinBosslet (Martin Bosslet) Martin.Bosslet@googlemail.com:

Time.mktime(2038, 1, 19, 11, 14, 8) failed. To my understanding, 32 bit Time
issues shouldn't occur in 1.9.3? I'm assigning this to Luis, maybe he knows
about this and what to do? Please feel free to reassign back to me.

I couldn't reproduce the problem on GNU/Linux (x86_64 and i686).

% ./ruby -ve 'Time.mktime(2038, 1, 19, 11, 14, 8)'
ruby 2.0.0dev (2012-06-11 trunk 36028) [x86_64-linux]

% ./ruby -ve 'Time.mktime(2038, 1, 19, 11, 14, 8)'
ruby 2.0.0dev (2012-06-11 trunk 36030) [i686-linux]

So it seems platform dependent issue.

However I think you should show the actual result (failure message) and
your timezone, though.

Note that my timzone is +0900 (JST).
--
Tanaka Akira

#3 Updated by Heesob Park almost 2 years ago

I guess it is not an issue of Time#mktime but an issue of OpenSSL.
Furthermore, the description is inaccurate.

Here is my test with ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
C:\Ruby193\bin>irb
irb(main):001:0> require 'OpenSSL'
=> true
irb(main):002:0> cert = OpenSSL::X509::Certificate.new
=> #
irb(main):003:0> cert.notafter = Time.mktime(2038, 1, 19, 12, 14, 7)
=> 2038-01-19 12:14:07 +0900
irb(main):004:0> cert.not
after = Time.mktime(2038, 1, 19, 12, 14, 8)
RangeError: bignum too big to convert into long'
from (irb):4:in
not_after='
from (irb):4
from C:/Ruby193/bin/irb:12:in `'

I think that this error due to timetotimet function defined in ext/openssl/osslasn1.c

timet
time
totimet(VALUE time)
{
return (timet)NUM2LONG(rbInteger(time));
}

#4 Updated by Nobuyoshi Nakada almost 2 years ago

  • Status changed from Feedback to Assigned
  • Assignee changed from Luis Lavena to Martin Bosslet
  • Target version changed from 1.9.3 to 2.0.0

#5 Updated by Martin Bosslet almost 2 years ago

  • Category changed from core to ext

Thanks for your analysis, guys. Makes sense now, why I couldn't reproduce it on 64 bits. The original #6122 did not contain the actual error that was raised, so thanks Heesob for pointing me towards the solution!

#6 Updated by Justin Peal over 1 year ago

Great thanks to all of you.

#7 Updated by Yusuke Endoh about 1 year ago

  • Target version changed from 2.0.0 to next minor

Also available in: Atom PDF