Skip to content

ouch ignores concatenated files in .gz and .xz #855

@kohane27

Description

@kohane27

Hello! Hope you are doing well.

Description

ouch only decompresses the first gzip stream when handling concatenated gzip files, resulting in incomplete decompression. I tried with gunzip and it correctly decompress all streams.

Reproducible test

echo "First gzip stream content - this is stream 1" > stream1.txt
echo "Second gzip stream content - this is stream 2" > stream2.txt
echo "Third gzip stream content - this is stream 3" > stream3.txt

gzip -c stream1.txt > concatenated-test.gz
gzip -c stream2.txt >> concatenated-test.gz
gzip -c stream3.txt >> concatenated-test.gz
$ gunzip -c concatenated-test.gz
First gzip stream content - this is stream 1
Second gzip stream content - this is stream 2
Third gzip stream content - this is stream 3
$ ouch d concatenated-test.gz
$ cat concatenated-test
First gzip stream content - this is stream 1

Expected result: 3 lines of text
Actual result: Only 1 line (first stream only)

Reproduction Steps

  1. Create a concatenated gzip file (multiple gzip streams in one file)
  2. Decompress with ouch d file.gz
  3. Decompress with gunzip -c file.gz > comparison.log
  4. Compare file sizes
$ ouch d ./file.gz

$ gunzip -c ./file.gz > comparison.log

$ file ./file.gz
./file.gz: gzip compressed data, original size modulo 2^32 674281

$ diff ./file <(head -c $(stat -c%s ./file) comparison.log)

Given there is no differences, it confirms that ouch output matches first portion of gunzip output.

Environment

  • ouch version: 0.6.1
  • OS: Linux 6.15.7

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions