Bug 487315 - tar causes unexpected termination of script
Summary: tar causes unexpected termination of script
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: tar
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-25 13:47 UTC by Quentin Armitage
Modified: 2009-03-06 12:40 UTC (History)
3 users (show)

Fixed In Version: tar-1.22-2.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-03-06 12:40:10 UTC
Type: ---
Embargoed:


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

Description Quentin Armitage 2009-02-25 13:47:56 UTC
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 16:54:29 UTC
Thanks for report, 141 looks like SIGPIPE ... will check the changes in the code ...

Comment 2 Ondrej Vasik 2009-03-03 17:04:17 UTC
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 09:14:15 UTC
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 13:32:13 UTC
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 13:33:19 UTC
Created attachment 334000 [details]
Patch to resolve SIGPIPE issue

Comment 6 Kamil Dudka 2009-03-05 23:15:47 UTC
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 10:52:21 UTC
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 12:40:10 UTC
(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.