"tar t" and aesthetics -- the fundamental problem

Natanael Copa natanael.copa at gmail.com
Wed Apr 19 00:34:38 UTC 2006


(i did it again... forgot to cc the list on the previous mail I sent.
anyway. it was about that freebsd is doing what rday proposed. sorry.)

Robert P. J. Day wrote:
> On Wed, 19 Apr 2006, Natanael Copa wrote:
> 
>> ... So I dig into the busybox code, where I find this around line
>> 197 in get_header_tar.c:
>>
>>         {       /* Strip trailing '/' in directories */
>>                 /* Must be done after mode is set as '/' is used to
>> check if its a directory */
>>                 char *tmp = last_char_is(file_header->name, '/');
>>                 if (tmp) {
>>                         *tmp = '\0';
>>                 }
>>         }
> 
> ok, that just makes me want to drink heavily.  the code uses the
> *trailing slash* to determine if the object is a directory?!?!  that
> is *so* not the way i think it should be done.

------------------------------------------------------------------------
r7453 | bug1 | 2003-09-09 19:41:03 +0200 (Tue, 09 Sep 2003) | 11 lines

If a tar entry is a regualr file ending in a '/' then its really a
directory.
>From http://www.gnu.org/manual/tar/html_node/tar_123.html
REGTYPE
AREGTYPE
    These flags represent a regular file. In order to be compatible with
older versions of tar, a typeflag value of AREGTYPE should be silently
recognized as a regular file. New archives should be created using
REGTYPE. Also, for backward compatibility, tar treats a regular file
whose name ends with a slash as a directory.


>> What? busybox is removing the trailing '/' in directories. Does
>> anyone knows why this is done?
> 
> personally, i don't think it should have been there in the first
> place.  i think that, if one wants a trailing slash as part of the
> output as a kind of visual indicator, it should have to be explicitly
> *added*.  technically, it's not part of the filename and it shouldn't
> ever be treated as if it is.

So, it should be removed and then later added?
Looks like freebsd trims it right before creating the dir with mkdir().

>> I also thinks it would be nice to strip any ./ in the beginning. It
>> will probably break my current scripts using it but it will make it
>> much easier to deal with.
> 
> *that* i'm not convinced of, until i can see whether that leading './'
>  should make a difference in selection operations.

freebsd tar does so and I believe they had a reason to. I'm not a very
experienced coder, but I do have more respect for bsd programmers than
gnu programmers.

What I do know that leading './' makes a difference when you "tar -t |
grep " things.

but thats no big deal.

> 
> rday




More information about the busybox mailing list