Skip to content

Commit c3de3b0

Browse files
authored
tar: add v1.35 (fix CVEs) (spack#47426)
1 parent 6da9bf2 commit c3de3b0

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

var/spack/repos/builtin/packages/tar/package.py

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ class Tar(AutotoolsPackage, GNUMirrorPackage):
2121

2222
license("GPL-3.0-or-later")
2323

24+
version("1.35", sha256="14d55e32063ea9526e057fbf35fcabd53378e769787eff7919c3755b02d2b57e")
2425
version("1.34", sha256="03d908cf5768cfe6b7ad588c921c6ed21acabfb2b79b788d1330453507647aed")
25-
version("1.32", sha256="b59549594d91d84ee00c99cf2541a3330fed3a42c440503326dab767f2fbb96c")
26-
version("1.31", sha256="b471be6cb68fd13c4878297d856aebd50551646f4e3074906b1a74549c40d5a2")
27-
version("1.30", sha256="4725cc2c2f5a274b12b39d1f78b3545ec9ebb06a6e48e8845e1995ac8513b088")
28-
version("1.29", sha256="cae466e6e58c7292355e7080248f244db3a4cf755f33f4fa25ca7f9a7ed09af0")
29-
version("1.28", sha256="6a6b65bac00a127a508533c604d5bf1a3d40f82707d56f20cefd38a05e8237de")
26+
with default_args(deprecated=True):
27+
# https://nvd.nist.gov/vuln/detail/CVE-2019-9923
28+
version("1.32", sha256="b59549594d91d84ee00c99cf2541a3330fed3a42c440503326dab767f2fbb96c")
29+
version("1.31", sha256="b471be6cb68fd13c4878297d856aebd50551646f4e3074906b1a74549c40d5a2")
30+
version("1.30", sha256="4725cc2c2f5a274b12b39d1f78b3545ec9ebb06a6e48e8845e1995ac8513b088")
31+
version("1.29", sha256="cae466e6e58c7292355e7080248f244db3a4cf755f33f4fa25ca7f9a7ed09af0")
32+
version("1.28", sha256="6a6b65bac00a127a508533c604d5bf1a3d40f82707d56f20cefd38a05e8237de")
3033

31-
depends_on("c", type="build") # generated
34+
depends_on("c", type="build")
3235

33-
# A saner default than gzip?
3436
variant(
3537
"zip",
3638
default="pigz",
@@ -52,42 +54,52 @@ class Tar(AutotoolsPackage, GNUMirrorPackage):
5254
patch("se-selinux.patch", when="@:1.29")
5355
patch("argp-pgi.patch", when="@:1.29")
5456
patch("gnutar-configure-xattrs.patch", when="@1.28")
57+
5558
# The NVIDIA compilers do not currently support some GNU builtins.
5659
# Detect this case and use the fallback path.
57-
patch("nvhpc-1.30.patch", when="@1.30:1.32 %nvhpc")
58-
patch("nvhpc-1.34.patch", when="@1.34 %nvhpc")
59-
# Workaround bug where __LONG_WIDTH__ is not defined
60-
patch("nvhpc-long-width.patch", when="@1.34 %nvhpc")
60+
with when("%nvhpc"):
61+
patch("nvhpc-1.30.patch", when="@1.30:1.32")
62+
patch("nvhpc-1.34.patch", when="@1.34")
63+
# Workaround bug where __LONG_WIDTH__ is not defined
64+
patch("nvhpc-long-width.patch", when="@1.34:")
65+
# Newer versions are marked as conflict for now
66+
conflicts("@1.35:", msg="NVHPC not yet supported for 1.35")
6167

6268
@classmethod
6369
def determine_version(cls, exe):
6470
output = Executable(exe)("--version", output=str, error=str)
6571
match = re.search(r"tar \(GNU tar\) (\S+)", output)
6672
return match.group(1) if match else None
6773

74+
def flag_handler(self, name, flags):
75+
if name == "ldflags" and self.spec.satisfies("@1.35"):
76+
# https://savannah.gnu.org/bugs/?64441
77+
flags.append("-liconv")
78+
return (flags, None, None)
79+
6880
def configure_args(self):
69-
spec = self.spec
7081
# Note: compression programs are passed by abs path,
7182
# so that tar can locate them when invoked without spack load.
7283
args = [
73-
"--with-xz={0}".format(spec["xz"].prefix.bin.xz),
74-
"--with-lzma={0}".format(spec["xz"].prefix.bin.lzma),
75-
"--with-bzip2={0}".format(spec["bzip2"].prefix.bin.bzip2),
84+
"--disable-nls",
85+
f"--with-xz={self.spec['xz'].prefix.bin.xz}",
86+
f"--with-lzma={self.spec['xz'].prefix.bin.lzma}",
87+
f"--with-bzip2={self.spec['bzip2'].prefix.bin.bzip2}",
7688
]
7789

78-
if spec["iconv"].name == "libiconv":
79-
args.append(f"--with-libiconv-prefix={spec['iconv'].prefix}")
80-
else:
81-
args.append("--without-libiconv-prefix")
82-
83-
if "^zstd" in spec:
84-
args.append("--with-zstd={0}".format(spec["zstd"].prefix.bin.zstd))
90+
if self.spec.dependencies("zstd"):
91+
args.append(f"--with-zstd={self.spec['zstd'].prefix.bin.zstd}")
8592

8693
# Choose gzip/pigz
87-
zip = spec.variants["zip"].value
94+
zip = self.spec.variants["zip"].value
8895
if zip == "gzip":
89-
gzip_path = spec["gzip"].prefix.bin.gzip
96+
gzip_path = self.spec["gzip"].prefix.bin.gzip
9097
elif zip == "pigz":
91-
gzip_path = spec["pigz"].prefix.bin.pigz
92-
args.append("--with-gzip={}".format(gzip_path))
98+
gzip_path = self.spec["pigz"].prefix.bin.pigz
99+
args.append(f"--with-gzip={gzip_path}")
100+
101+
if self.spec["iconv"].name == "libiconv":
102+
args.append(f"--with-libiconv-prefix={self.spec['iconv'].prefix}")
103+
else:
104+
args.append("--without-libiconv-prefix")
93105
return args

0 commit comments

Comments
 (0)