Red Hat Bugzilla – Bug 487315
tar causes unexpected termination of script
Last modified: 2009-03-06 07:40:10 EST
Created attachment 333159 [details]
Compressed tar file that causes tar problem described
Description of problem:
With certain tar files, when reading from a pipeline, tar can unexpectedly terminate with exit code 141. If run from within a shell script, it causes the shell script to terminate with exit code 141.
Version-Release number of selected component (if applicable):
Approx 70% of times run
Steps to Reproduce:
1.tar -xzOf kmod-ipt-ipopt_184.108.40.206-brcm47xx-1_mipsel.ipk ./data.tar.gz | tar -tzf -
2. echo $?
tar command exits with error code 141, or causes shell script to terminate with same error code.
Exit code of tar commands should be 0, and surrounding shell script should continue executing.
Problem does not appear to occur with tar-1.20-6.fc11.i386
The following works without a problem:
tar -xzOf kmod-ipt-ipopt_220.127.116.11-brcm47xx-1_mipsel.ipk ./data.tar.gz | zcat | tar -tf -
The problem seems to only occur with certain tar files. I have attached the one referred to in the tar commands above.
Thanks for report, 141 looks like SIGPIPE ... will check the changes in the code ...
Strange ... on my machine with tar-1.21-1.fc11 it doesn't occur... could you please attach strace? (as it seems to be sigpipe, I guess strace of second tar command is enough)
It happens occasionally. Unfortunately I am not able to trigger this error when running through strace. This is maybe related to this change in tar-1.21: http://lists.gnu.org/archive/html/bug-tar/2008-12/msg00028.html
I have created a patch that reverts the change referred to in Comment #3 above. My tests show that the SIGPIPE problems is rectified by the patch.
The patch which resolves the issue (tar-1.21-SIGPIPE.patch) is attached.
P.S. My machine is a 2GHz single core laptop, which may well make the problem more likely to occur.
Created attachment 334000 [details]
Patch to resolve SIGPIPE issue
Created attachment 334230 [details]
This seems to be Fedora specific, caused by tar-1.14-loneZeroWarning.patch. Try the attached patch instead of the one from CVS.
I have tried the attached patch, and can confirm that it resolves the problem for both tar v1.21 and tar v1.22. I have also build tar v1.22 without the loneZeroWarning patch, and that does not exhibit the problem.
In summary, from my tests, it was the tar-1.14-loneZeroWarning.patch in CVS that caused the problem and the patch attached in Comment #6 resolves the problem.
(In reply to comment #7)
Thank you for testing it! Built as tar-1.22-2.fc11.