From owner-cvs-all@FreeBSD.ORG Sat Jun 5 22:09:19 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3855016A4CE; Sat, 5 Jun 2004 22:09:19 -0700 (PDT) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7394343D3F; Sat, 5 Jun 2004 22:09:18 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i5659G5v015552; Sun, 6 Jun 2004 15:09:16 +1000 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i5659C2O002402; Sun, 6 Jun 2004 15:09:13 +1000 Date: Sun, 6 Jun 2004 15:09:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Tim Kientzle In-Reply-To: <40C22518.6060406@kientzle.com> Message-ID: <20040606143616.W2060@gamplex.bde.org> References: <20040605053115.45AE416A585@hub.freebsd.org> <20040605000326.B54841@root.org> <40C22518.6060406@kientzle.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@freebsd.org cc: Tim Kientzle cc: src-committers@freebsd.org cc: cvs-all@freebsd.org cc: Nate Lawson Subject: Re: cvs commit: src/lib/libarchive archive_read_extract.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2004 05:09:19 -0000 On Sat, 5 Jun 2004, Tim Kientzle wrote: > Nate Lawson wrote: > > On Fri, 4 Jun 2004, Tim Kientzle wrote: > > > >>+ * Yes, people really do type "tar -cf - foo/." for > >>+ * reasons that I cannot fathom. > > > > That's what tab completion in tcsh does. > > Tab completion adds the slash, but not the > dot, which is the issue here. I've noticed > that "foo/." does force gtar to archive the > dir target of a symlink, which may explain the > usage. > > In particular, mkdir("foo/.") always fails, hence > the need for an additional check. (I'm considering > reworking this code to explicitly check for and remove > a trailing "/." sequence before trying to create the dir.) Removing "/." might break handling of symlinks. > >>+ if (stat(name, &st) == 0 && S_ISDIR(st.st_mode)) > > ^^^^^^^ ^^^^ Perhaps this or a nearby stat() should be lstat(). libarchive doesn't use a single lstat() (though bsdtar does). In fact, this stuff is quite broken. After "cd /tmp; ln -s /tmp foo", tarring up foo[/.] gives the following misbehaviours with yesterday's versions of tars: tar cf z foo: only puts foo in the archive (correct) bsdtar cf z foo: same, except bsdtar seems to be too smart about padding the output to a block boundary for regular files, so subsequent piping of the file might not work tar cf z foo/: only puts foo in the archive (broken) bsdtar cf z foo/: same tar cf z foo/.: puts files named foo/./* in the archive (everything under /tmp except z). Warns about not attempting to put the archive inside itself. bsdtar cf z foo/.: same, except it silently puts a truncated copy of the archive inside itself. Bruce