Hi,

In archival/libarchive/data_extract_all.c, there is a note that "only 
root's tar preserves perms (see bug 3844)", and it forces the 
ARCHIVE_DONT_RESTORE_PERM flag unless run by root. I can't find bug 
3844 - it is invalid on https://bugs.busybox.net/. Could anyone help me 
find the bug report (or explain why this shouldn't be fixed?)

When run by a non-root user, the chmod at the end of data_extract_all
is not run, so the mode is not corrected from what mkdir made it.

To see the problem:

$ umask
0022
$ id -u
1000
$ mkdir -m 777 x
$ ls -ld x
drwxrwxrwx    2 ben      ben             40 Oct  7 10:54 x

$ tar c x | tar -C tmp -x
$ ls -ld tmp/x
drwxr-xr-x    2 ben      ben             40 Oct  7 10:54 tmp/x
$ rmdir tmp/x
$ tar c x | tar -C tmp -xp
$ ls -ld tmp/x
drwxr-xr-x    2 ben      ben             40 Oct  7 10:54 tmp/x

For comparison, the behaviour of GNU tar (as non-root):

$ tar c x | gtar -C tmp -x
drwxr-xr-x    2 ben      ben             40 Oct  7 10:54 tmp/x

$ tar c x | gtar -C tmp -xp
drwxrwxrwx    2 ben      ben             40 Oct  7 10:54 tmp/x

Ben
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to