Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Apr 2007 11:51:19 -0700
From:      Tim Kientzle <kientzle@freebsd.org>
To:        =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= <des@des.no>
Cc:        cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/lib/libarchive Makefile archive_write_set_format_pax.c archive_write_set_format_ustar.c src/lib/libarchive/test Makefile test_tar_filenames.c
Message-ID:  <462122A7.7080102@freebsd.org>
In-Reply-To: <86ejmnz10n.fsf@dwp.des.no>
References:  <200704140820.l3E8KVqP092404@repoman.freebsd.org> <86ejmnz10n.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
>>  Conventionally, tar archives have always included a trailing '/'
>>  for directories.  bsdtar used to add this, but that recently got
>>  lost somehow.  So now I'm adding it back in libarchive.
> 
> Is that really a good idea?  Shouldn't this just be fixed in bsdtar's
> display code?

It's not a display problem, it's an archive creation problem.
Very old tar implementations didn't recognize dirs stored in
archives, but could actually extract them correctly as long
as the name ended in '/'.

>>  The only odd part of doing this in libarchive:  Adding a directory to
>>  a tar archive and then reading it back again can yield a different name.
> 
> I can imagine how this might trip up other (hypothetical) libarchive
> consumers...

You may be right.  But not all archive formats
necessarily require trailing '/' on directories and
I've (so far) done pretty well at keeping format-specific
knowledge out of bsdtar.

I could force trailing '/' when creating archives from
bsdtar or ensure the trailing '/' in libarchive for
those formats that require it.  Neither solution is
ideal.

I think I'll stick with it in libarchive, though
I'll change it so that libarchive actually edits the
name in the entry; that way, the client will see the
changed name immediately after writing the header.
(There's precedent for this; some libarchive formats
edit the file size field to indicate how much data
they expect; this allows clients to function
efficiently with formats that do or don't store
duplicate bodies for hard links.)

Thanks for the comments.

Tim



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?462122A7.7080102>