cvs commit: src/lib/libarchive archive_read_extract.c

Bruce Evans bde at
Sun Jun 6 05:09:19 GMT 2004

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/:
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


More information about the cvs-src mailing list