Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
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)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Depends On:
  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:
Last Closed: 2000-07-25 21:00:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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)
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
#rpm -q gzip

I have:

#tar --version
tar (GNU tar) 1.13.17
#gzip --version
gzip 1.3

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

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
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.