From nobody@FreeBSD.org  Mon Feb 18 11:32:28 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 2DF6937B405
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 18 Feb 2002 11:32:27 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g1IJWRZ04572;
	Mon, 18 Feb 2002 11:32:27 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200202181932.g1IJWRZ04572@freefall.freebsd.org>
Date: Mon, 18 Feb 2002 11:32:27 -0800 (PST)
From: Clint <clint+freebsddotorg@acm.vt.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: TAR does not recurse directories if it runs into a file with "\" in the title followed by a space.
X-Send-Pr-Version: www-1.0

>Number:         35087
>Category:       bin
>Synopsis:       TAR does not recurse directories if it runs into a file with "\" in the title followed by a space.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 18 11:40:01 PST 2002
>Closed-Date:    Thu Aug 22 10:21:05 PDT 2002
>Last-Modified:  Thu Aug 22 10:21:05 PDT 2002
>Originator:     Clint
>Release:        4.5 i guess
>Organization:
>Environment:
reeBSD cowpie.acm.vt.edu 4.5-STABLE FreeBSD 4.5-STABLE #0: Mon Feb  4 00:07:35 EST 2002     root@cowpie.acm.vt.edu:/usr/src/sys/compile/GENERIC  i386
>Description:
It seems like putting a "\" in the filename is causing tar to
mess up ... it wont recurse directories.  A script that I'd been using for years finally died when I created a file called something like "__\  reminder\ to\ self\ __" ... The resulting tar would only be the files in the root directory -- it stopped recursing when it hit the filename with spaces and backslashes in it.  And nowadays with windows supporting long filenames, most filenames have spaced in them (to my experience, having over a terabyte of my own data.)
thanks
>How-To-Repeat:
see above
>Fix:
black magic
>Release-Note:
>Audit-Trail:

From: Giorgos Keramidas <keramida@freebsd.org>
To: Clint <clint+freebsddotorg@acm.vt.edu>
Cc: bug-followup@freebsd.org
Subject: Re: bin/35087: TAR does not recurse directories if it runs into a file with "\" in the title followed by a space.
Date: Sun, 24 Feb 2002 23:57:15 +0200

 On 2002-02-18 11:32, Clint wrote:
 
 > It seems like putting a "\" in the filename is causing tar to mess up ...
 > it wont recurse directories.  A script that I'd been using for years
 > finally died when I created a file called something like "__\  reminder\
 > to\ self\ __" ... The resulting tar would only be the files in the root
 > directory -- it stopped recursing when it hit the filename with spaces
 > and backslashes in it.  And nowadays with windows supporting long
 > filenames, most filenames have spaced in them (to my experience, having
 > over a terabyte of my own data.)
 
 Hello Clint,
 
 Are you sure this is not some bug of shell quoting, or the way you invoke
 tar(1)?  It seems to work nicely here, for the filename you gave as an
 example.  Perhaps there is a problem, and if you provided us with the exact
 script and/or program that invokes tar(1) we could research this more :)
 
 See for instance what happens on a -CURRENT box I use as a workstation at
 home.  The last time I build world was Feb 17, 2002:
 
 [ create a test spac in /tmp/0 ]
 
 	% cd /tmp
 	% mkdir 0
 	% cd 0
 
 [ create the file of the bug-report ]
 
 	% touch "__\  reminder\ to\ self\ __"
 	% ls -la
 	total 2
 	drwxr-xr-x  2 charon  wheel  512 Feb 23 18:24 ./
 	drwxrwxrwt  5 root    wheel  512 Feb 23 18:23 ../
 	-rw-r--r--  1 charon  wheel    0 Feb 23 18:24 __\\  reminder\\ to\\ self\\ __
 
 [ file shows up ok, now create some normal files to test tar(1) ]
 
 	% touch lala
 	% ls -la
 	total 2
 	drwxr-xr-x  2 charon  wheel  512 Feb 23 18:24 ./
 	drwxrwxrwt  5 root    wheel  512 Feb 23 18:23 ../
 	-rw-r--r--  1 charon  wheel    0 Feb 23 18:24 __\\  reminder\\ to\\ self\\ __
 	-rw-r--r--  1 charon  wheel    0 Feb 23 18:24 lala
 	% mkdir foo
 	% touch foo/bar
 	% ls -lR
 	total 1
 	-rw-r--r--  1 charon  wheel    0 Feb 23 18:24 __\\  reminder\\ to\\ self\\ __
 	drwxr-xr-x  2 charon  wheel  512 Feb 23 18:24 foo/
 	-rw-r--r--  1 charon  wheel    0 Feb 23 18:24 lala
 
 	./foo:
 	total 0
 	-rw-r--r--  1 charon  wheel  0 Feb 23 18:24 bar
 
 [ try to create a tarball of current directory in /tmp/0.tgz ]
 
 	% tar cvf - . | gzip -9c - >/tmp/0.tgz
 	./
 	__\\  reminder\\ to\\ self\\ __
 	lala
 	foo/
 	foo/bar
 
 [ worked.  now let's see what was written in the tarball. ]
 
 	% cd /tmp
 	% tar tzvf 0.tgz
 	drwxr-xr-x charon/wheel      0 Feb 23 18:24 2002 ./
 	-rw-r--r-- charon/wheel      0 Feb 23 18:24 2002 __\\  reminder\\ to\\ self\\ __
 	-rw-r--r-- charon/wheel      0 Feb 23 18:24 2002 lala
 	drwxr-xr-x charon/wheel      0 Feb 23 18:24 2002 foo/
 	-rw-r--r-- charon/wheel      0 Feb 23 18:24 2002 foo/bar
 
 Everything seems to work like a charm.  Can we have a look at the program
 that seems to show the tar(1) misbehavior for you?
 
 Giorgos Keramidas                           FreeBSD Documentation Project
 keramida@{freebsd.org,ceid.upatras.gr}      http://www.FreeBSD.org/docproj/

From: Mike Heffner <mheffner@vt.edu>
To: Giorgos Keramidas <keramida@FreeBSD.ORG>
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/35087: TAR does not recurse directories if it runs into 
Date: Mon, 11 Mar 2002 00:24:03 -0500 (EST)

 On 24-Feb-2002 Giorgos Keramidas wrote:
 |  
 |  Are you sure this is not some bug of shell quoting, or the way you
 | invoke
 |  tar(1)?  It seems to work nicely here, for the filename you gave as an
 |  example.  Perhaps there is a problem, and if you provided us with the
 | exact
 |  script and/or program that invokes tar(1) we could research this more
 |:)
 |  
 
 
 It's reproduciable only when the filenames are specified individually or
 with a filelist (see PR gnu/34939). The following is from a 4.5-STABLE
 machine last cvsup'd Feb. 28:
 
 $ pwd
 /tmp
 $ mkdir test
 $ cd test
 $ touch foo
 $ touch "foo\bar"
 $ touch foobar
 $ ls -l
 total 0
 -rw-------  1 mheffner  wheel  0 Mar 11 00:18 foo
 -rw-------  1 mheffner  wheel  0 Mar 11 00:18 foo\bar
 -rw-------  1 mheffner  wheel  0 Mar 11 00:18 foobar
 $ cd ..
 $ tar cvf test.tar test/*
 test/foo
 tar: can't add file test/foar : No such file or directory
 test/foobar
 
 
 I haven't had a chance to test this on -current yet.
 
 Mike
 
 -- 
   Mike Heffner   <mheffner@[acm.]vt.edu>
   Blacksburg, VA     <mikeh@FreeBSD.org>
 
State-Changed-From-To: open->patched 
State-Changed-By: sobomax 
State-Changed-When: Tue Jun 4 10:53:20 PDT 2002 
State-Changed-Why:  
Modern GNU tar which was just imported into the -CURRENT doesn't have this 
problem. Therefore, the problem will befilly resolved when tar upgrade is 
MFC'ed in about 1 month. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35087 
State-Changed-From-To: patched->closed 
State-Changed-By: johan 
State-Changed-When: Thu Aug 22 10:20:35 PDT 2002 
State-Changed-Why:  
GNU tar 1.13.25 has been MFCed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35087 
>Unformatted:
