0

I have a corrupted file called file.tar.gz and I want to the extraction of it to fail. I used tar --no-ignore-command-error -xvzf file.tar.gz but it still extracting the files, and ignoring the errors:

[root@SmartSwitch zconf]# tar --no-ignore-command-error -xvzf a.tar.gz
gzip: crc error
gzip: error inflating
DBversion
License
textual_db.txt
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
1

When you extract a compressed archive, GNU tar runs gzip -d to decompress the data. If the archive is corrupt in such a way that gzip can't decompress it properly, you will get gzip errors like the ones you report in the question.

tar will read the data that gzip successfully decompresses and exit when that data has been processed (with an error if the end of the uncompressed archive occurs unexpectedly, as you show).

The --no-ignore-command-error option (which is set by default) is primarily useful together with the --to-command=utility option, and according to the manual, especially if you have --ignore-command-error as part of the TAR_OPTIONS environment variable.

It is unclear whether --no-ignore-command-error and --ignore-command-error has any effect on child processes not started through --to-command=utility.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.