Bug 11714 - bug with tar exit code.
bug with tar exit code.
Status: CLOSED DUPLICATE of bug 15448
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-05-28 12:33 EDT by mal
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-07-25 21:00:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description mal 2000-05-28 12:33:58 EDT
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 14:57:00 EDT
Can't reproduce this one on beta4.  tar is 1.13.17-6.
Comment 2 mal 2000-07-25 20:53:31 EDT
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-25 21:00:15 EDT
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 10:43:29 EDT

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

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