[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    tar -p doesn't account for umask when extracting
From:       Ben Fuller <ben () bvnf ! space>
Date:       2022-10-07 10:26:55
Message-ID: 20221007102655.qpxgpmwe4663jd2i () t480
[Download RAW message or body]

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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic