Bug 487315 - tar causes unexpected termination of script
tar causes unexpected termination of script
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: tar (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-25 08:47 EST by Quentin Armitage
Modified: 2009-03-06 07:40 EST (History)
3 users (show)

See Also:
Fixed In Version: tar-1.22-2.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-06 07:40:10 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Compressed tar file that causes tar problem described (11.93 KB, application/octet-stream)
2009-02-25 08:47 EST, Quentin Armitage
no flags Details
Patch to resolve SIGPIPE issue (2.83 KB, patch)
2009-03-04 08:33 EST, Quentin Armitage
no flags Details | Diff
improved tar-1.14-loneZeroWarning.patch (981 bytes, patch)
2009-03-05 18:15 EST, Kamil Dudka
no flags Details | Diff

  None (edit)
Description Quentin Armitage 2009-02-25 08:47:56 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):
tar-1.21-1.fc11.i386

How reproducible:
Approx 70% of times run

Steps to Reproduce:
1.tar -xzOf kmod-ipt-ipopt_2.6.28.7-brcm47xx-1_mipsel.ipk ./data.tar.gz | tar -tzf -
2. echo $?
3.
  
Actual results:
tar command exits with error code 141, or causes shell script to terminate with same error code.

Expected results:
Exit code of tar commands should be 0, and surrounding shell script should continue executing.

Additional info:
Problem does not appear to occur with tar-1.20-6.fc11.i386
The following works without a problem:
tar -xzOf kmod-ipt-ipopt_2.6.28.7-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.
Comment 1 Ondrej Vasik 2009-02-25 11:54:29 EST
Thanks for report, 141 looks like SIGPIPE ... will check the changes in the code ...
Comment 2 Ondrej Vasik 2009-03-03 12:04:17 EST
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)
Comment 3 Kamil Dudka 2009-03-04 04:14:15 EST
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
Comment 4 Quentin Armitage 2009-03-04 08:32:13 EST
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.
Comment 5 Quentin Armitage 2009-03-04 08:33:19 EST
Created attachment 334000 [details]
Patch to resolve SIGPIPE issue
Comment 6 Kamil Dudka 2009-03-05 18:15:47 EST
Created attachment 334230 [details]
improved tar-1.14-loneZeroWarning.patch

This seems to be Fedora specific, caused by tar-1.14-loneZeroWarning.patch. Try the attached patch instead of the one from CVS.
Comment 7 Quentin Armitage 2009-03-06 05:52:21 EST
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.
Comment 8 Kamil Dudka 2009-03-06 07:40:10 EST
(In reply to comment #7)
Thank you for testing it! Built as tar-1.22-2.fc11.

Note You need to log in before you can comment on or make changes to this bug.