Bug 15448 - tar exit code is still incorrect
tar exit code is still incorrect
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
: 11714 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-08-04 17:22 EDT by mal
Modified: 2008-05-01 11:37 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-09-23 13:27:45 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)
Here is a patch that fixes it for me. (1.11 KB, patch)
2000-08-07 10:12 EDT, Tim Waugh
no flags Details | Diff
This is a letter from Paul Eggert (tar mantainer), it should help. (40.41 KB, text/plain)
2000-08-15 17:36 EDT, mal
no flags Details
Fix for 'tar hangs' problem (175 bytes, patch)
2000-09-23 13:27 EDT, Tim Waugh
no flags Details | Diff

  None (edit)
Description mal 2000-08-04 17:22:38 EDT
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 16:30:53 EDT
verified behavior ... thanks for the report!
Comment 2 Tim Waugh 2000-08-07 10:12:04 EDT
Created attachment 2176 [details]
Here is a patch that fixes it for me.
Comment 3 Bernhard Rosenkraenzer 2000-08-07 10:17:21 EDT
The patch looks ok - applied it.
Comment 4 Bernhard Rosenkraenzer 2000-08-07 10:43:27 EDT
*** Bug 11714 has been marked as a duplicate of this bug. ***
Comment 5 Derek Tattersall 2000-08-15 13:10:59 EDT
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 17:36:32 EDT
Created attachment 2525 [details]
This is a letter from Paul Eggert (tar mantainer), it should help.
Comment 7 mal 2000-08-15 18:16:35 EDT
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-15 20:41:05 EDT
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@twinsun.com>
Message-Id: <200008160020.RAA05399@ruby.twinsun.com>
To: vmalyshkin@columbusgrp.com
In-reply-to: <399982E3.C67BFE9D@columbusgrp.com> (vmalyshkin@columbusgrp.com)
Subject: Re: Bug with tar exit code
References: <3999469A.5B1A644A@columbusgrp.com>
<200008152127.OAA02934@ruby.twinsun.com> <399982E3.C67BFE9D@columbusgrp.com>


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

   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-15 20:44:26 EDT
Also, it may not be clear, 
comments after ====================
belong to me, not to Paul
Comment 10 mal 2000-08-18 10:20:10 EDT
Can this bug be fixed before the relase,
the fix is provided in second attachment.
Comment 11 Bernhard Rosenkraenzer 2000-08-18 11:06:18 EDT
It's fixed in the internal tree, waiting for QA approval
Comment 12 mal 2000-08-26 16:03:35 EDT
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 17:13:41 EDT
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 17:14:17 EDT
Oops, make that 1.13.17-8
Comment 15 Tim Waugh 2000-09-23 13:27:06 EDT
(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 13:27:43 EDT
Created attachment 3522 [details]
Fix for 'tar hangs' problem
Comment 17 Bernhard Rosenkraenzer 2000-10-09 05:55:04 EDT
Fixed in -9

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