From 193fd8a237ce715a94ce89ec6e7f61c2da9510d1 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 3 Jun 2024 18:40:23 +0100 Subject: [PATCH] generic/setup.sh: handle $sourceRoot that starts with dash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the change `runPhase` fails on tarballs like `diffoscope-269` that contain single top-level `-269` root as: diffoscope> unpacking source archive /nix/store/p620nidkm73vrp0z6kk5krmrm4vg7bxd-diffoscope-269.tar.bz2 diffoscope> source root is -269 diffoscope> setting SOURCE_DATE_EPOCH to timestamp 1717143039 of file ./-269/tests/utils/versions.py diffoscope> chmod: invalid mode: ‘-269’ diffoscope> Try 'chmod --help' for more information. Currently `diffoscope-269` has a `sourceRoot = "./-269";` workaround to bypass the failure. --- pkgs/stdenv/generic/setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index d7521b1ad5da..02513af6b8f8 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1577,9 +1577,9 @@ runPhase() { if [ "$curPhase" = unpackPhase ]; then # make sure we can cd into the directory - [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}" + [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}" - cd "${sourceRoot:-.}" + cd -- "${sourceRoot:-.}" fi }