[PATCH] support for user and group names in tar

Natanael Copa natanael.copa at gmail.com
Fri Apr 21 07:23:02 PDT 2006


Glenn L. McGrath wrote:
> On Thu, 20 Apr 2006 19:23:19 +0200
> Natanael Copa <natanael.copa at gmail.com> wrote:
> 
>> +++ archival/libunarchive/get_header_tar.c	(working copy)
>> @@ -124,6 +124,12 @@
>>  	file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
>>  	file_header->link_name = (tar.formated.linkname[0] != '\0') ?
>>  	    bb_xstrdup(tar.formated.linkname) : NULL;
>> +#ifdef CONFIG_TAR_UNAME_GNAME
> 
> should be
>> +#ifdef CONFIG_FEATURE_TAR_UNAME_GNAME

oups... it breaks other things too.

> :)

yeah.. >:)

:)

> 
> Did a simple test and it displayed uname/gname

Please find the attatched update of the patch.

The attatched patch does this:
- adds a CONFIG_FEATURE_TAR_UNAME_GNAME option to enable use of user and
group names.
- initialize file_header in init_handle.c
- removes the code that strips the trailing '/' in directories.
- display username and groupname if available when listing contents.
- look up /etc/passwd for uid when unpacking with -p option (preserve
permissions)

I have tested to list tarballs, unpack tarballs with and wihout -p with
usernames that exists and usernames that not exists on local system. I
have tested tarballs created of gnu tar and freebsd tar.

I have tested cpio and unzip (i dont have any rpm's and debs right here
now). I had to initialize file_header in init_handle.c. cpio (and
probably all the other archivers) or they would segfault on unpacking.

The other archivers should not be affected. If the patch unexpectedly
breaks anything it can be completely reverted (except the initialize of
file_header) by disabling CONFIG_FEATURE_TAR_UNAME_GNAME in menuconfig.

The patch opens up for adding user and group name use in the other
archivers too. All archivers that has support for "preserve permissions"
could have use of it.


Nat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tar-uname-gname2.patch
Type: text/x-patch
Size: 5653 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20060421/f4c2139b/tar-uname-gname2-0001.bin


More information about the busybox mailing list