summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2020-07-14 00:19:04 +0200
committerGitHub <noreply@github.com>2020-07-13 15:19:04 -0700
commit2b809a537469b39e44080d33899e6b0756956309 (patch)
treea646a94d86487d7a2f2c93f585f121adba94d164 /lib
parent3e13137f6eabc66b0c3d60acfbe3e5e834742849 (diff)
downloadspack-2b809a537469b39e44080d33899e6b0756956309.tar.gz
spack-2b809a537469b39e44080d33899e6b0756956309.tar.bz2
spack-2b809a537469b39e44080d33899e6b0756956309.tar.xz
spack-2b809a537469b39e44080d33899e6b0756956309.zip
Add `-o` flag to tar decompressor (#17427)
For normal users, `-o` or `--no-same-owner` (GNU extension) is the default behavior, but for the root user, `tar` attempts to preserve the ownership from the tarball. This makes `tar` use `-o` all the time. This should improve untarring files owned by users not available in rootless Docker builds.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/util/compression.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/util/compression.py b/lib/spack/spack/util/compression.py
index 1688b49f1b..ebbe0519d0 100644
--- a/lib/spack/spack/util/compression.py
+++ b/lib/spack/spack/util/compression.py
@@ -14,7 +14,7 @@ EXTS = ["gz", "bz2", "xz", "Z"]
NOTAR_EXTS = ["zip", "tgz", "tbz2", "txz"]
# Add PRE_EXTS and EXTS last so that .tar.gz is matched *before* .tar or .gz
-ALLOWED_ARCHIVE_TYPES = [".".join(l) for l in product(
+ALLOWED_ARCHIVE_TYPES = [".".join(ext) for ext in product(
PRE_EXTS, EXTS)] + PRE_EXTS + EXTS + NOTAR_EXTS
@@ -36,7 +36,7 @@ def decompressor_for(path, extension=None):
bunzip2 = which('bunzip2', required=True)
return bunzip2
tar = which('tar', required=True)
- tar.add_default_arg('-xf')
+ tar.add_default_arg('-oxf')
return tar