From 7a713fe2413ff1cdb96f8007dc39dffe638e2060 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Tue, 14 Jun 2022 15:29:20 -0700 Subject: [PATCH 1/3] setup.sh: verify that `find` is from findutils PR #168413 causes `setup.sh` to use `find`. Packages which put `busybox` into their `nativeBuildInputs` will have `$busybox/bin/find` ahead of `$findutils/bin/find` in `$PATH` when `setup.sh` is run, causing `setup.sh` to fail. Let's check that `find` is really from findutils so we can provide a more useful error message. The `setup.sh` script already does a similar check to make sure that the shell it is running under is `bash` rather than some other shell. A longer-term solution to the problem of `busybox`'s outpaths conflicting with `stdenv`s is described here: https://github.com/NixOS/nixpkgs/pull/177682#issuecomment-1155730371 --- pkgs/stdenv/generic/setup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 40ffd9344e34d..9d2d9aecc5b0b 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1022,6 +1022,15 @@ configurePhase() { fixLibtool "$i" done + # Make sure `find` is the full `find` from findutils, rather + # than from busybox or some other implementation. This is + # analogous to `shellcheck shell=bash` at the top of this + # file. + if (( $(find --version | grep -q 'GNU findutils') != 0 )); then + echo 'the find in $PATH is not findutils' + exit -1 + fi + # replace `/usr/bin/file` with `file` in any `configure` # scripts with vendored libtool code. Preserve mtimes to # prevent some packages (e.g. libidn2) from spontaneously From 3abdc33aa2cdda0ef46235529bf547356e22beea Mon Sep 17 00:00:00 2001 From: Adam Joseph <54836058+a-m-joseph@users.noreply.github.com> Date: Tue, 14 Jun 2022 23:07:48 +0000 Subject: [PATCH 2/3] Update pkgs/stdenv/generic/setup.sh Co-authored-by: Sandro --- pkgs/stdenv/generic/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 9d2d9aecc5b0b..e4eefa8558a0c 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1028,7 +1028,7 @@ configurePhase() { # file. if (( $(find --version | grep -q 'GNU findutils') != 0 )); then echo 'the find in $PATH is not findutils' - exit -1 + exit 1 fi # replace `/usr/bin/file` with `file` in any `configure` From 3bee12d2d2e5db6ed5a9d6f70b3f7b88ccbbc22c Mon Sep 17 00:00:00 2001 From: Adam Joseph <54836058+a-m-joseph@users.noreply.github.com> Date: Tue, 14 Jun 2022 23:07:56 +0000 Subject: [PATCH 3/3] Update pkgs/stdenv/generic/setup.sh Co-authored-by: Sandro --- pkgs/stdenv/generic/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index e4eefa8558a0c..6035d362f0ca7 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -1027,7 +1027,7 @@ configurePhase() { # analogous to `shellcheck shell=bash` at the top of this # file. if (( $(find --version | grep -q 'GNU findutils') != 0 )); then - echo 'the find in $PATH is not findutils' + echo 'The find contained in $PATH is not the GNU variant from the findutils package.' exit 1 fi