Pavel Raiskup wrote:
Use '--compres-program'-like API by the -Z, but also by -z, -J,
--lzop and --lzma options.
I oppose this, except perhaps for -Z.
AFAIK, tar files are compressible enough that none of those compressors
has been reported as returning 2, and if important programs like GNU tar
begin accepting an exit status of '2' as success for those compressors,
it will prevent them from switching to the correct and sane API of bzip2
and lzip which allows callers to tell I/O errors (status 1) from invalid
files (status 2).
It seems that pigz does not use the compress API.
Moreover, I think an even more complex patch would be needed for this to
work also when tar automaticaly chooses the compressor by archive name
extension.
Would it not be easier to make tar pass the '-f' flag to compress (and
perhaps the compress-like compressors)?
$ dd if=/dev/urandom of=testfile bs=1K count=1024
$ ls -go testfile*
-rw-r--r-- 1 1048576 2013-04-28 15:04 testfile
$ compress testfile ; echo $?
2
$ ls -go testfile*
-rw-r--r-- 1 1048576 2013-04-28 15:04 testfile
$ compress -f testfile ; echo $?
0
$ ls -go testfile*
-rw-r--r-- 1 1415373 2013-04-28 15:04 testfile.Z
$
Best regards,
Antonio.