ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: merch-redmine@jeremyevans.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:96929] [Ruby master Bug#9790] Zlib::GzipReader only decompressed the first of concatenated files
Date: Fri, 17 Jan 2020 16:04:35 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-83956.20200117160435.b6c714d943e9d2ab@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-9790.20140430205653@ruby-lang.org

Issue #9790 has been updated by jeremyevans0 (Jeremy Evans).


shyouhei (Shyouhei Urabe) wrote:
> Do you know if there are cases when taking a random member of such gzip file is actually useful?

It's not taking a random member, it's processing the separate gzip streams in order, which is actually useful.  For example, in OpenBSD's packages, the first gzip stream in the package contains the package metadata.  That is read completely, and after processing the metadata, the programs that handle packages determine whether it needs to read the actual package data (stored in the second gzip stream).  If it doesn't need to process the package data, it can then stop at that point without having read any more than it needs to.

----------------------------------------
Bug #9790: Zlib::GzipReader only decompressed the first of concatenated files
https://bugs.ruby-lang.org/issues/9790#change-83956

* Author: quainjn (Jake Quain)
* Status: Feedback
* Priority: Normal
* Assignee: drbrain (Eric Hodel)
* Target version: 
* ruby -v: 2.1.1
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
There is a similar old issue in Node that I came across that perfectly describes the situation in ruby:

https://github.com/joyent/node/issues/6032

In ruby given the following setup:

```
echo "1" > 1.txt
echo "2" > 2.txt
gzip 1.txt
gzip 2.txt
cat 1.txt.gz 2.txt.gz > 3.txt.gz
```

Calling:
    
```
Zlib::GzipReader.open("3.txt.gz") do |gz|
  print gz.read
end
```

would just print:

```
1
```


---Files--------------------------------
zlib-gzreader-each_file-9790.patch (3.47 KB)


-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2020-01-17 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-9790.20140430205653@ruby-lang.org>
2014-04-30 20:56 ` [ruby-core:62257] [ruby-trunk - Bug #9790] [Open] Zlib::GzipReader only decompressed the first of concatenated files quainjn
2014-05-01 22:53 ` [ruby-core:62271] [ruby-trunk - Bug #9790] [Assigned] " drbrain
2015-02-24 16:17 ` [ruby-core:68286] [Ruby trunk - Bug #9790] " akostadinov
2015-02-25  6:16 ` [ruby-core:68303] " duerst
2015-05-26  9:37 ` [ruby-core:69362] " exaspark
2019-11-27 15:38 ` [ruby-core:95987] [Ruby master Bug#9790] " merch-redmine
2020-01-14  4:10 ` [ruby-core:96832] " ko1
2020-01-14  4:33 ` [ruby-core:96833] " merch-redmine
2020-01-16  7:39 ` [ruby-core:96898] " ko1
2020-01-16 14:32 ` [ruby-core:96910] " daniel
2020-01-17  4:51 ` [ruby-core:96922] " shyouhei
2020-01-17 14:17 ` [ruby-core:96927] " daniel
2020-01-17 16:04 ` merch-redmine [this message]
2020-01-18  0:51 ` [ruby-core:96933] " nobu
2020-01-18  1:07 ` [ruby-core:96934] " merch-redmine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-83956.20200117160435.b6c714d943e9d2ab@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).