From asami@vader.cs.berkeley.edu  Tue Jan  7 02:57:34 1997
Received: from dfw-ix8.ix.netcom.com (dfw-ix8.ix.netcom.com [206.214.98.8])
          by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id CAA15000
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 7 Jan 1997 02:57:33 -0800 (PST)
Received: from silvia.HIP.Berkeley.EDU (wck-ca14-58.ix.netcom.com [207.92.174.122]) by dfw-ix8.ix.netcom.com (8.6.13/8.6.12) with ESMTP id CAA09955 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 7 Jan 1997 02:56:49 -0800
Received: (from asami@localhost) by silvia.HIP.Berkeley.EDU (8.8.4/8.6.9) id CAA03829; Tue, 7 Jan 1997 02:56:20 -0800 (PST)
Message-Id: <199701071056.CAA03829@silvia.HIP.Berkeley.EDU>
Date: Tue, 7 Jan 1997 02:56:20 -0800 (PST)
From: asami@freebsd.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: tar will extract files even if -C command fails
X-Send-Pr-Version: 3.2

>Number:         2394
>Category:       gnu
>Synopsis:       tar will extract files even if -C command fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan  7 03:00:01 PST 1997
>Closed-Date:    Mon Jul 27 11:40:18 PDT 1998
>Last-Modified:  Mon Jul 27 11:42:26 PDT 1998
>Originator:     Satoshi Asami
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
The FreeBSD Project
>Environment:

It's up there.

>Description:

When you execute the command:

tar -C /nonexistent/path -xf tarfile

tar will complain about -C failing but will extract the files (in the
current directory) anyway.  This can be especially disastrous if the
command is actually the second half of a pipe, as in

tar cf - . | tar -C /nonexistent/path -xf -

because this can cause files in the current directory to be truncated
and then padded with zeros.  (A surefire way to destroy your root
partition while trying to back it up.)

>How-To-Repeat:

It's up there.

>Fix:
	
Tried to fix it myself but got lost in the spaghetti of conditionals. ;)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: nectar 
State-Changed-When: Mon Jul 27 11:40:18 PDT 1998 
State-Changed-Why:  
fixed in -current, tar/tar.c rev 1.14 and tar/tar.h rev 1.6 
fixed: tar will extract file even if -C command fails 
tar now exits with new exit code EX_BADDIR after a failed chdir() 
in name_next(), name_match(), and name_from_list(). 
PR:             bin/2394 
Submitted by:   Satoshi Asami <asami@freebsd.org> 
>Unformatted:
