ouch icon indicating copy to clipboard operation
ouch copied to clipboard

ouch ignores concatenated files in `.gz` and `.xz`

Open kohane27 opened this issue 5 months ago • 1 comments

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!

kohane27 avatar Jul 22 '25 14:07 kohane27

Thanks for the well written description :)

I updated the title to include .xz

marcospb19 avatar Jul 26 '25 21:07 marcospb19