Hey David,
Em 04/06/2024 17:07, David Cantrell escreveu:
busybox tar doesn't mention -p in its docs so I don't think it's fair
to say that it's broken. It just doesn't support that option.
I got something different here, maybe is related to the version?
localhost:~$ tar --help
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.
Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE]
[LONGOPT]... [FILE]...
Create, extract, or list files from a tar file
c Create
x Extract
t List
-f FILE Name of TARFILE ('-' for stdin/out)
-C DIR Change to DIR before operation
-v Verbose
-O Extract to stdout
-m Don't restore mtime
-o Don't restore user:group
-k Don't replace existing files
-Z (De)compress using compress
-z (De)compress using gzip
-J (De)compress using xz
-j (De)compress using bzip2
--lzma (De)compress using lzma
-a (De)compress based on extension
-h Follow symlinks
-T FILE File with names to include
-X FILE File with glob patterns to exclude
--exclude PATTERN Glob pattern to exclude
--overwrite Replace existing files
--strip-components NUM NUM of leading components to strip
--no-recursion Don't descend in directories
--numeric-owner Use numeric user:group
--no-same-permissions Don't restore access permissions
Nothing there about "-p", but "--no-same-permissions" tells me it should
do it by default, which doesn't work either.
After some effort to have manpages installed on Alpine, I got this:
-p, --preserve-permissions, --same-permissions
Set permissions of extracted files to those recorded in the
archive (default for superuser).
Then I tried all the three variations, with the following results:
* -p and --same-permissions are ignored
* --preserve-permissions is not accepted as a valid argument
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ tar --same-permissions -xvf
t/data/bar.tar
bar/
bar/bar.dat
bar/foo.dat
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ ls -l bar/
total 8
-rw-r--r-- 1 goku goku 11 Jul 24 2005 bar.dat
-rw-r--r-- 1 goku goku 11 Jul 24 2005 foo.dat
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ rm -rf bar/
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ tar --preserve-permissions
-xvf t/data/bar.tar
tar: unrecognized option: preserve-permissions
BusyBox v1.36.1 (2023-11-07 18:53:09 UTC) multi-call binary.
Usage: tar c|x|t [-ZzJjahmvokO] [-f TARFILE] [-C DIR] [-T FILE] [-X FILE]
[LONGOPT]... [FILE]...
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ tar -x -v -p -f
t/data/bar.tar
bar/
bar/bar.dat
bar/foo.dat
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ ls -l bar/
total 8
-rw-r--r-- 1 goku goku 11 Jul 24 2005 bar.dat
-rw-r--r-- 1 goku goku 11 Jul 24 2005 foo.dat
As a reminder, Archive::Tar::Wrapper is expecting to get the group with
"rw" permissions:
localhost:~/.cpan/build/Archive-Tar-Wrapper-0.40-0$ tar -tvf t/data/bar.tar
drwxrwxr-x mschilli/mschilli 0 2005-07-24 16:15:34 bar/
-rw-rw-r-- mschilli/mschilli 11 2005-07-24 16:15:27 bar/bar.dat
-rw-rw-r-- mschilli/mschilli 11 2005-07-24 16:15:34 bar/foo.dat