[Bug-tar] Error in sending compressed data to stdout file descriptor
From:
Jibie Job
Subject:
[Bug-tar] Error in sending compressed data to stdout file descriptor
Date:
Tue, 6 Dec 2005 04:32:12 -0500
I have found what I assume to be a bug or an undocumented behavior in
gnu tar version 1.15.1, which is the latest available release as of 6th
December 2005.
The following two commands do not generate the same output file though they are logically equivalent
tar -czf bla.tar.gz bla/ (normal file size)
tar -czf - bla/ > bla.tar.gz (larger file size containing garbage data at the end)
The second command yields a bigger file that always contains garbage data at the end of the file.
Hence the data passed from tar to the stdout file descriptor is different from the data it saves directly to a file.
This behavior was only noticed when compression filters, included as
part of the tar program, are used. The error is not particular to
either the gzip or bzip compression system because the above effect is
observed no matter which one is used isolating the fault to the general
compression filter framework.
This was verified when the following two commands yielded identical
output verifying that error only crops in a subsequent stage.
tar -cf bla.tar bla/ (normal file)
tar -cf - bla/ > bla.tar (normal file)
As a final check the following two commands yielded identical output
and verifies that the smaller files that were assumed to be correct are
indeed so.
tar -czf bla.tar.gz
bla/
(normal)
tar -cf - bla/ | gzip > bla.tar.gz (normal)
In summary, the differences in the stdout stream are noted only when a
compression filter is used and is present regardless of the compression
system used(gzip,bzip).
Any input about the reason for this behavior would be welcome.
-JJ