about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2024-02-17 08:45:01 +0100
committerVladimír Čunát <v@cunat.cz>2024-02-17 08:45:01 +0100
commiteff11adc57c8709f80e12a0b2d7d054448d4543f (patch)
tree12e786cd7917536dfe13d47f5b53ab1217b05a8d /pkgs/stdenv
parent50b5b5b529facc043866fc7721f50cd7a688e70a (diff)
parent11a19109b687ea8f263870effe0513f2225771b1 (diff)
Merge #286721: stdenv: fix rare tar.xz decompression issues
...into staging
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/setup.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index a150345d77b99..9c918b12f96ef 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -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