Merge #286721: stdenv: fix rare tar.xz decompression issues

...into staging
This commit is contained in:
Vladimír Čunát 2024-02-17 08:45:01 +01:00
commit eff11adc57
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA

View file

@ -1065,7 +1065,11 @@ _defaultUnpack() {
# stages. The XZ_OPT env var is only used by the full "XZ utils" implementation, which supports
# the --threads (-T) flag. This allows us to enable multithreaded decompression exclusively on
# that implementation, without the use of complex bash conditionals and checks.
XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn" | tar xf - --warning=no-timestamp
# Since tar does not control the decompression, we need to
# disregard the error code from the xz invocation. Otherwise,
# it can happen that tar exits earlier, causing xz to fail
# from a SIGPIPE.
(XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; true) | tar xf - --warning=no-timestamp
;;
*.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz)
# GNU tar can automatically select the decompression method