Subject: bin/19339: pax as tar won't handle -r right
To: None <gnats-bugs@gnats.netbsd.org>
From: Martin Weber <Ephaeton@gmx.net>
List: netbsd-bugs
Date: 12/10/2002 13:26:08
>Number:         19339
>Category:       bin
>Synopsis:       tar -r won't realize it should handle *tar* archives
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 10 07:51:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Martin Weber
>Release:        NetBSD 1.6K
>Organization:
Entropie Erlangen
	
>Environment:
	
	
System: NetBSD phaeton.entropie.net 1.6K NetBSD 1.6K (PHAETON) #3: Wed Nov 20 10:38:37 CET 2002 root@phaeton.entropie.net:/usr/src/sys/arch/i386/compile/PHAETON i386
Architecture: i386
Machine: i386
>Description:
	The old tar could handle empty archives, i.e. the following would
	work:
	$ touch ayaken.tar #<-- fresh, empty file
	$ tar -rf ayaken.tar banzai geronimo

	At this point ayaken.tar would contain the two files banzai and geronimo

	The pax-as-tar won't handle this right. (see how to repeat).
	even worse than that, it does nothing and returns success !!!
	That means if you rely on exitting success means no error occured,
	and delete the (as you believe) archived file(s), you are fucked.

	This hurts especially as the old tar was able to do this ...
	
>How-To-Repeat:
	$ touch ayaken.tar banzai geronimo
	$ if tar -rf ayaken.tar banzai geronimo; then echo success; else echo failure; fi
	tar: Sorry, unable to determine archive format.
	success
	$
	
>Fix:
	Either have tar return EXIT_FAILURE if it could not determine the
	archive format. Or have tar use the standard tar format as archive
	format (after all, pax is invoked as ``TAR'' !). Or do both. Or
	document that ``tar'' won't try to create ``tar'' archives.
	

>Release-Note:
>Audit-Trail:
>Unformatted:
 /bin/tar:
      $NetBSD: crt0.c,v 1.12 2001/12/30 23:23:38 thorpej Exp $
      $NetBSD: ar_io.c,v 1.27 2002/10/16 03:46:07 christos Exp $
      $NetBSD: ar_subs.c,v 1.20 2002/10/18 11:54:22 itojun Exp $
      $NetBSD: buf_subs.c,v 1.17 2002/01/31 19:27:53 tv Exp $
      $NetBSD: cpio.c,v 1.13 2002/02/11 10:57:57 wiz Exp $
      $NetBSD: file_subs.c,v 1.25 2002/10/17 00:32:36 christos Exp $
      $NetBSD: ftree.c,v 1.23 2002/10/19 20:33:18 provos Exp $
      $NetBSD: gen_subs.c,v 1.26 2002/10/13 00:34:16 mrg Exp $
      $NetBSD: getoldopt.c,v 1.16 2002/10/13 00:32:09 mrg Exp $
      $NetBSD: options.c,v 1.55 2002/10/18 13:45:05 christos Exp $
      $NetBSD: pat_rep.c,v 1.16 2002/10/23 19:39:42 christos Exp $
      $NetBSD: pax.c,v 1.22 2002/10/20 00:40:29 christos Exp $
      $NetBSD: sel_subs.c,v 1.15 2002/01/31 19:27:54 tv Exp $
      $NetBSD: tables.c,v 1.18 2002/10/12 15:39:30 christos Exp $
      $NetBSD: tar.c,v 1.32 2002/10/27 20:48:15 christos Exp $
      $NetBSD: tty_subs.c,v 1.11 2002/01/31 19:27:54 tv Exp $
      $NetBSD: spec.c,v 1.47 2002/02/11 12:43:55 lukem Exp $
      $NetBSD: misc.c,v 1.23 2002/02/19 04:54:12 lukem Exp $
      $NetBSD: stat_flags.c,v 1.15 2002/11/16 13:42:36 itojun Exp $
      $NetBSD: pack_dev.c,v 1.3 2002/01/31 22:43:42 tv Exp $