Bug 487315

Summary: tar causes unexpected termination of script
Product: [Fedora] Fedora Reporter: Quentin Armitage <quentin>
Component: tarAssignee: Ondrej Vasik <ovasik>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: kdudka, ovasik, quentin
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tar-1.22-2.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-03-06 12:40:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Compressed tar file that causes tar problem described
none
Patch to resolve SIGPIPE issue
none
improved tar-1.14-loneZeroWarning.patch none

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.