From 2019f82e3ee5764ae2d63a53ef5a44310b7c7f77 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Sun, 4 Jul 2021 19:16:06 +0200 Subject: [PATCH] bmake: enable ksh test on non musl platforms bmake runs the ksh test if /bin/ksh exists. This is never a good indication on platforms where we can sandbox and causes problems on darwin where this path may exist, but never would be in PATH. We solve this problem by always enabling the test and adding ksh to checkInputs. ksh doesn't seem to compile with musl, so we disable it on that platform. --- .../tools/build-managers/bmake/default.nix | 15 ++++++++++++--- .../bmake/unconditional-ksh-test.patch | 12 ++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/tools/build-managers/bmake/unconditional-ksh-test.patch diff --git a/pkgs/development/tools/build-managers/bmake/default.nix b/pkgs/development/tools/build-managers/bmake/default.nix index 11bc58897023..0d8ca351096c 100644 --- a/pkgs/development/tools/build-managers/bmake/default.nix +++ b/pkgs/development/tools/build-managers/bmake/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, fetchpatch -, getopt, tzdata +, getopt, tzdata, ksh , pkgsMusl # for passthru.tests }: @@ -14,9 +14,12 @@ stdenv.mkDerivation rec { # Make tests work with musl # * Disable deptgt-delete_on_error test (alpine does this too) + # * Disable shell-ksh test (ksh doesn't compile with musl) # * Fix test failing due to different strerror(3) output for musl and glibc postPatch = lib.optionalString (stdenv.hostPlatform.libc == "musl") '' - sed -i unit-tests/Makefile -e '/deptgt-delete_on_error/d' + sed -i unit-tests/Makefile \ + -e '/deptgt-delete_on_error/d' \ + -e '/shell-ksh/d' substituteInPlace unit-tests/opt-chdir.exp --replace "File name" "Filename" ''; @@ -29,6 +32,8 @@ stdenv.mkDerivation rec { ./fix-unexport-env-test.patch # Fix localtime tests without global /etc/zoneinfo directory ./fix-localtime-test.patch + # Always enable ksh test since it checks in a impure location /bin/ksh + ./unconditional-ksh-test.patch # decouple tests from build phase (fetchpatch { name = "separate-tests.patch"; @@ -69,7 +74,11 @@ stdenv.mkDerivation rec { ''; doCheck = true; - checkInputs = [ tzdata ]; + checkInputs = [ + tzdata + ] ++ lib.optionals (stdenv.hostPlatform.libc != "musl") [ + ksh + ]; checkPhase = '' runHook preCheck diff --git a/pkgs/development/tools/build-managers/bmake/unconditional-ksh-test.patch b/pkgs/development/tools/build-managers/bmake/unconditional-ksh-test.patch new file mode 100644 index 000000000000..117b85da16d1 --- /dev/null +++ b/pkgs/development/tools/build-managers/bmake/unconditional-ksh-test.patch @@ -0,0 +1,12 @@ +--- bmake/unit-tests/Makefile.orig 2021-07-04 19:13:09.068094922 +0200 ++++ bmake/unit-tests/Makefile 2021-07-04 19:13:14.630080696 +0200 +@@ -295,9 +295,7 @@ + TESTS+= sh-single-line + TESTS+= shell-csh + TESTS+= shell-custom +-.if exists(/bin/ksh) + TESTS+= shell-ksh +-.endif + TESTS+= shell-sh + TESTS+= suff-add-later + TESTS+= suff-clear-regular