Merge pull request #14723 from carlocab/zlib-mtime
utils/gzip: set `mtime = 1` when `mtime == 0`.
This commit is contained in:
commit
f0fbeba2ef
@ -28,11 +28,11 @@ module Utils
|
|||||||
# Zlib::GzipWriter does not properly handle the case of setting mtime = 0:
|
# Zlib::GzipWriter does not properly handle the case of setting mtime = 0:
|
||||||
# https://bugs.ruby-lang.org/issues/16285
|
# https://bugs.ruby-lang.org/issues/16285
|
||||||
#
|
#
|
||||||
# This was fixed in https://github.com/ruby/zlib/pull/10. Set mtime to 0 instead
|
# This was fixed in https://github.com/ruby/zlib/pull/10. Remove workaround
|
||||||
# of raising exception once we are using zlib gem version 1.1.0 or newer.
|
# once we are using zlib gem version 1.1.0 or newer.
|
||||||
if mtime.to_i.zero?
|
if mtime.to_i.zero?
|
||||||
raise ArgumentError,
|
odebug "Setting `mtime = 1` to avoid zlib gem bug when `mtime == 0`."
|
||||||
"Can't create reproducible gzip file without a valid mtime"
|
mtime = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(path, "rb") do |fp|
|
File.open(path, "rb") do |fp|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user