Open jamieklassen opened 3 years ago
Above I was checking node-tar against bsdtar on macos. I just tried with gnu tar:
mkdir dir
sudo chown 501 dir
tar -czf tarball.tgz dir
sudo gtar --strip-components=1 -xzf tarball.tgz
ls -an
and the output agrees with bsdtar, but disagrees with node-tar
What / Why
When the
tar
utility runs with--strip-components
and-p
(or as root), no existing directories have their permissions changed. However, when node-tar does the equivalent, the existing filesystem can be mutated.How
Steps to Reproduce
In an empty directory, run
Expected Behavior
When I run
which should be roughly equivalent, the output is
Actual Behavior
When I run the above script using node-tar, the output is
The results are almost identical, except in the node-tar case the current directory has changed ownership from UID 502 to UID 501.
References
I encountered this while investigating a problem with running backstage's tests.