Hi Denys,

You are right - this is related to fact that the tar command is executed
in a post-install scriptlet of an RPM package:

>From rpm.spec:

...
%post
...
tar -zxvf patch.tar.gz
...

The rpm command (rpm --install --replacefiles --nodeps file.rpm) is run
under a shell with umask 077.

If I run the tar command myself under the same shell, the
file-permissions are okay, but if the tar command runs in the rpm
context the permissions aren't okay.

If I change umask (e.g. to 022) before running the rpm command, then the
permissions are also okay (at least for the owner and group parts which
are what matter to me).

I am not sure this is really related to busybox tar itself after all,
but if you have any idea what could be going on here (from busybox tar's
point of view) - why the umask 077 is not ignored by tar when running
from rpm post-install scriptlet and is ignored otherwise - I'd
appreciate any such ideas (meanwhile I'll try looking at the rpm sources
a bit).

The rpm in question is rpm 4.0 (very old indeed), similar to the one
from the RedHat distribution.

Thanks,
/Danny

-----Original Message-----
From: Denys Vlasenko [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 18, 2008 1:56 AM
To: [email protected]
Cc: Aizer Danny-BDA023
Subject: Re: busybox tar supporting -p option (preserving permissions)

On Sunday 17 February 2008 19:38, Aizer Danny-BDA023 wrote:
> Hi,
>  
> It seems that busybox's tar applet doesn't support the -p option which

> is standard for (e.g.) GNU tar.

What do you mean by "doesn't support"? It errors out on it?
It accepts it but doesn't honor?

Since you didn't send this info, I tried to check myself.

sh-3.2# /usr/bin/tar --version
tar (GNU tar) 1.15.1

sh-3.2# ./tar --help
BusyBox v1.10.0.svn (2008-02-17 00:31:14 CET) multi-call binary ...

Both seem to create files with exact mode from tarfile, _even without -p
option_:

sh-3.2# umask 077
sh-3.2# ./tar xjf *.tar.bz2
sh-3.2# ls -l
drwxr-xr-x   30 root     root         1152 Feb 18 00:46 busybox-1.9.1
^^^^^^^^^^
-rw-r--r--    1 root     root      1795971 Feb 12 17:14
busybox-1.9.1.tar.bz2
-rwxr-xr-x    1 root     root       783672 Feb 18 00:44 tar
sh-3.2# rm -rf busybox-1.9.1
sh-3.2# /usr/bin/tar xjf *.tar.bz2
sh-3.2# ls -l
drwxr-xr-x   30 root     root         1152 Feb 12 17:14 busybox-1.9.1
^^^^^^^^^^
-rw-r--r--    1 root     root      1795971 Feb 12 17:14
busybox-1.9.1.tar.bz2
-rwxr-xr-x    1 root     root       783672 Feb 18 00:44 tar

(I also looked inside those dirs: files have -rw-r--r-- mode too, so
umask 077 is not affecting files either).

> Is there a way to achieve the same
> functionality using the busybox tar, or can this option be supported 
> by busybox tar? Otherwise it seems that tar extracts files and creates

> them using the current user's umask, which sometimes means that files 
> have the wrong permissions after extraction.

Testcase?
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to