From: nobu@... Date: 2018-09-27T09:25:48+00:00 Subject: [ruby-core:89186] [Ruby trunk Feature#15160] ArgumentError: year too big to marshal Issue #15160 has been updated by nobu (Nobuyoshi Nakada). Tracker changed from Bug to Feature ruby -v deleted (ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-darwin17]) Backport deleted (2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN) This is a limit of current marshal format of `Time`, not a bug. This is a [patch] to extend the limit, but it has a little problem on marshal data compatibility. ``` $ ./ruby -e 'Marshal.dump(Time.new(1900), STDOUT)'|ruby -e 'p Marshal.load(STDIN)' 67436-01-01 00:00:00 +0900 ``` Dumped out-of-range `Time` with this patch will be loaded as the distant future, when loaded in old ruby. [patch]: https://github.com/nobu/ruby/tree/feature/15160-Time-dump-range ---------------------------------------- Feature #15160: ArgumentError: year too big to marshal https://bugs.ruby-lang.org/issues/15160#change-74212 * Author: Dirk (Dirk Meier-Eickhoff) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I encountered the problem, that marshaling a Time object does not always work. Try run following commands in irb that will raise an error: ~~~ ruby Marshal.dump(Time.new(1900)) #Traceback (most recent call last): # 3: from (irb):35 # 2: from (irb):35:in `dump' # 1: from (irb):35:in `_dump' #ArgumentError (year too big to marshal: 1899 UTC) Marshal.dump(Time.new(1899)) #Traceback (most recent call last): # 3: from (irb):37 # 2: from (irb):37:in `dump' # 1: from (irb):37:in `_dump' #ArgumentError (year too big to marshal: 1898 UTC) ~~~ Following commands will work fine: ~~~ ruby Marshal.dump(Time.new(1901)) # => "\x04\bIu:\tTime\r\xF7/\x00\x80\x00\x00\x00\x00\a:\voffseti\x02\x10\x0E:\tzoneI\"\bCET\x06:\x06EF" Marshal.dump(Date.new(1899)) # => "\x04\bU:\tDate[\vi\x00i\x03@\xD8$i\x00i\x00i\x00f\f2299161" ~~~ I'm in timezone CEST (UTC+2). I tested it at MacOS High Sierra (10.13.6 (17G65)) and Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-135-generic x86_64) with two Ruby versions: - ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17] - ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-darwin17] I expect that all Time objects can be marshaled, even if they are prior 1900. -- https://bugs.ruby-lang.org/ Unsubscribe: