Bug 15448

Summary: tar exit code is still incorrect
Product: [Retired] Red Hat Linux Reporter: mal
Component: tarAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: dkl, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-09-23 17:27:45 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
Here is a patch that fixes it for me.
none
This is a letter from Paul Eggert (tar mantainer), it should help.
none
Fix for 'tar hangs' problem none

Description mal 2000-08-04 21:22:38 UTC
There is still a problem with tar 
in RedHat 7.0 beta.
It does not produce correct exit code when used with compression,
and because of this even if backup filed tar
produces 0 exit code:

echo AAA >/tmp/AAA
tar zcvf /dev/st0 /tmp/AAA
tar: Removing leading `/' from member names
tmp/AAA
[root@localhost /tmp]# tar (grandchild): /dev/st0: Cannot open: No such
device
tar (grandchild): Error is not recoverable: exiting now
echo $?
0

See, exit code 0 but tar failed.
In the same time if you use it without compression
(no z) then exit code is correct (=2)

tar cvf /dev/st0 /tmp/AAA
tar: /dev/st0: Cannot open: No such device
tar: Error is not recoverable: exiting now
[root@localhost /tmp]# echo $?
2

Comment 1 Brock Organ 2000-08-06 20:30:53 UTC
verified behavior ... thanks for the report!

Comment 2 Tim Waugh 2000-08-07 14:12:04 UTC
Created attachment 2176 [details]
Here is a patch that fixes it for me.

Comment 3 Bernhard Rosenkraenzer 2000-08-07 14:17:21 UTC
The patch looks ok - applied it.


Comment 4 Bernhard Rosenkraenzer 2000-08-07 14:43:27 UTC
*** Bug 11714 has been marked as a duplicate of this bug. ***

Comment 5 Derek Tattersall 2000-08-15 17:10:59 UTC
tar-1.13.17-7 does not work for me.  
[root@test176 /root]# tar czvvf /dev/st0 /tmp/install.log 
tar: Removing leading `/' from member names
-rw-r--r-- root/root     18419 2000-08-15 05:17:59 tmp/install.log
[root@test176 /root]# tar (grandchild): /dev/st0: Cannot open: No such device
tar (grandchild): Error is not recoverable: exiting now
echo $?
0
[root@test176 /root]# 

Notice the prompt in the middle of the tar messages.  Notice the return code. 
Still has a good return.

I've reopened the problem.


Comment 6 mal 2000-08-15 21:36:32 UTC
Created attachment 2525 [details]
This is a letter from Paul Eggert (tar mantainer), it should help.

Comment 7 mal 2000-08-15 22:16:35 UTC
Everything works OK with this new buffer.c file
from Paul Eggert 

-- With new buffer.c ----
./tar zcvf /dev/st0 /tmp/AAA
./tar: Removing leading `/' from member names
tmp/AAA
tar (child): /dev/st0: Cannot open: No such device
tar (child): Error is not recoverable: exiting now
./tar: Child returned status 2
./tar: Error exit delayed from previous errors
[root@eth0_extrenal src]# echo $?
2



Comment 8 mal 2000-08-16 00:41:05 UTC
I post Paul Eggert comments in regards with new buffer.c

=============================================================
Date: Tue, 15 Aug 2000 17:20:25 -0700 (PDT)
From: Paul Eggert <eggert>
Message-Id: <200008160020.RAA05399.com>
To: vmalyshkin
In-reply-to: <399982E3.C67BFE9D> (vmalyshkin)
Subject: Re: Bug with tar exit code
References: <3999469A.5B1A644A>
<200008152127.OAA02934.com> <399982E3.C67BFE9D>


   Date: Tue, 15 Aug 2000 13:50:27 -0400
   From: Vladislav Malyshkin <vmalyshkin>

   Would you recomend to use this buffer.c file for next RedHat?

Sorry, I don't have time to think through all the changes right now.
But I would say that if you limit it only to the changes related
to child processes, it would be reasonable to recommend it.
=============================================================

Also, if you do diff in between new and old buffer.c 
the other changes are really minor.
Mostly comments changes and little cleanup,
line using  assign_string instad of strcpy
It looks like new buffer.c can go as is.

Comment 9 mal 2000-08-16 00:44:26 UTC
Also, it may not be clear, 
comments after ====================
belong to me, not to Paul

Comment 10 mal 2000-08-18 14:20:10 UTC
Can this bug be fixed before the relase,
the fix is provided in second attachment.

Comment 11 Bernhard Rosenkraenzer 2000-08-18 15:06:18 UTC
It's fixed in the internal tree, waiting for QA approval

Comment 12 mal 2000-08-26 20:03:35 UTC
The package ftp://ftp.redhat.com/pub/rawhide/SRPMS/SRPMS/tar-1.13.17-7.src.rpm
from current rawhide does not fix the problem.
It uses pach from (id=2176) which does not fix exit code problem.
Use the fix from attachment (id=2525) which really solves the problem.

Comment 13 Bernhard Rosenkraenzer 2000-08-26 21:13:41 UTC
I know - this patch is in 1.13-8, which has been in the internal tree for a
while.
It's fixed for 7.0.

Comment 14 Bernhard Rosenkraenzer 2000-08-26 21:14:17 UTC
Oops, make that 1.13.17-8

Comment 15 Tim Waugh 2000-09-23 17:27:06 UTC
(id=2525) may fix the exit code problem, but now gives far worse behaviour: tar
zvt < test.tgz now hangs. :-(((

I'll attach a tentative fix.

Comment 16 Tim Waugh 2000-09-23 17:27:43 UTC
Created attachment 3522 [details]
Fix for 'tar hangs' problem

Comment 17 Bernhard Rosenkraenzer 2000-10-09 09:55:04 UTC
Fixed in -9