-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
GzipReader#mtime always just returns the timestamp of the time that the object was created instead of an actual modification time read from the GZip header.
Here is some example code that reproduces this issue:
require 'zlib'
require 'stringio'
io = StringIO.new "\x1f\x8b\x08\x00\x44\x33\x22\x11\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"
r = Zlib::GzipReader.new(io)
puts "%x" % r.mtimeWhen I run this program with MRI 2.0.0, it correctly prints "11223344". When I run it with JRuby I get the current timestamp.
Here is shell output showing what version of JRuby I am running and the incorrect output:
$ jruby -v && jruby test.rb
jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [Windows 8-amd64]
52dc9f31
When I looked, I couldn't see any code in the GzipReader class that actually grabs the modification time from jzlib and stores it.
I would have simply fixed this and submitted a pull request, but jzlib also has a bug in it preventing it from reporting the modification time correctly. We need to wait for ymnk/jzlib#13 to be handled before I can fix JRuby.