Bug 11714

Summary: bug with tar exit code.
Product: [Retired] Red Hat Linux Reporter: mal
Component: tarAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-07-26 01:00:17 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:

Description mal 2000-05-28 16:33:58 UTC
There is a bug with tar exit code.
Create a small file AA  (4 bytes),
and try to tar it to the tape /dev/st1
which does not exists.
tar prints error message (as it should be),
but exits with the code 0, what is incorrect.

echo AAA >AA
tar zcvf /dev/st1 AA
tar (grandchild): /dev/st1: Cannot open: No such device
tar (grandchild): Error is not recoverable: exiting now
but the exit code of tar iz 0.
This is incorrect.

In the same time when I am trying to tar
many files to a non-existing device /dev/st1
tar oftern (but not always) exits with the right (non-zero) exit code.

Comment 1 Derek Tattersall 2000-07-25 18:57:00 UTC
Can't reproduce this one on beta4.  tar is 1.13.17-6.

Comment 2 mal 2000-07-26 00:53:31 UTC
I do not have 1.13.17-6, I have 1.13.17-4 (from RedHat 6.2)
then.
It is hard for me to try it, because 
new packages from Rawhide require rpm 4.0
what will probably require to upgrade half of the system.
Anyway, in 

#rpm -q tar
tar-1.13.17-4
#rpm -q gzip
gzip-1.3-3

I have:

#tar --version
tar (GNU tar) 1.13.17
#gzip --version
gzip 1.3
(1999-12-21)

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

The error code may be non-zero on a bigger files.
In the same time  tar cvf /dev/st1 /tmp/AAA (without "z") always return
2,
as it should be.

The problem with this tar exit code is that
even if backup failed there is no way to find this from 
the script.



Comment 3 mal 2000-07-26 01:00:15 UTC
Could you test the commands of above 
on plain RedHat 6.2 (tar 1.13.17-4) and then on
rawhide with tar 1.13.17-6.
If it exists in RedHat 6.2 and does not exist in rawhide-
the bug is probably fixed. 
If you can not reproduce it on RedHat 6.2 
you can send me URL for tar source you used, 
I will compile it and try.

Comment 4 Bernhard Rosenkraenzer 2000-08-07 14:43:29 UTC

*** This bug has been marked as a duplicate of 15448 ***