ruby-changes:65815
From: Yusuke <ko1@a...>
Date: Thu, 8 Apr 2021 14:27:07 +0900 (JST)
Subject: [ruby-changes:65815] ee372aa873 (master): test/zlib/test_zlib.rb: Set binmode to test output file
https://git.ruby-lang.org/ruby.git/commit/?id=ee372aa873 From ee372aa8735b8836d074b90a41bf69269292a977 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 8 Apr 2021 14:22:59 +0900 Subject: test/zlib/test_zlib.rb: Set binmode to test output file Seems like the test `TestZlibGzipFile#test_gzip_reader_zcat` fails when the timestamp has `\n\n`. https://ci.appveyor.com/project/ruby/ruby/builds/38597932 ``` 1) Error: TestZlibGzipFile#test_gzip_reader_zcat: Zlib::DataError: invalid distance too far back C:/projects/ruby/test/zlib/test_zlib.rb:522:in `initialize' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `new' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `zcat' C:/projects/ruby/test/zlib/test_zlib.rb:522:in `block (2 levels) in test_gzip_reader_zcat' C:/projects/ruby/test/zlib/test_zlib.rb:521:in `open' C:/projects/ruby/test/zlib/test_zlib.rb:521:in `block in test_gzip_reader_zcat' C:/projects/ruby/lib/tempfile.rb:358:in `create' C:/projects/ruby/test/zlib/test_zlib.rb:510:in `test_gzip_reader_zcat' ``` The test time is around 2021-04-08 04:40 +0900. Maybe the following time should trigger the bug. ``` irb(main):001:0> Time.at(1617824266) => 2021-04-08 04:37:46 +0900 irb(main):002:0> [1617824266].pack("V") => "\n\nn`" ``` --- test/zlib/test_zlib.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index af3578a..be05701 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -508,6 +508,7 @@ if defined? Zlib https://github.com/ruby/ruby/blob/trunk/test/zlib/test_zlib.rb#L508 class TestZlibGzipFile < Test::Unit::TestCase def test_gzip_reader_zcat Tempfile.create("test_zlib_gzip_file_to_io") {|t| + t.binmode gz = Zlib::GzipWriter.new(t) gz.print("foo") gz.close -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/