···1+diff --git a/tests/checks/path.fish b/tests/checks/path.fish
2+index 62812571a..b0eebcd91 100644
3+--- a/tests/checks/path.fish
4++++ b/tests/checks/path.fish
5+@@ -117,12 +117,6 @@ path filter --type file,dir --perm exec,write bin/fish .
6+ # So it passes.
7+ # CHECK: .
8+9+-mkdir -p sbin
10+-touch sbin/setuid-exe sbin/setgid-exe
11+-chmod u+s,a+x sbin/setuid-exe
12+-path filter --perm suid sbin/*
13+-# CHECK: sbin/setuid-exe
14+-
15+ # On at least FreeBSD on our CI this fails with "permission denied".
16+ # So we can't test it, and we fake the output instead.
17+ if chmod g+s,a+x sbin/setgid-exe 2>/dev/null
+58-27
pkgs/by-name/fi/fish/package.nix
···1{
2 stdenv,
3 lib,
4- fetchurl,
5- fetchpatch,
6 coreutils,
7- which,
8 gnused,
9 gnugrep,
10 groff,
11 gawk,
12 man-db,
013 getent,
14 libiconv,
15 pcre2,
016 gettext,
17 ncurses,
18 python3,
019 cmake,
20 fishPlugins,
21 procps,
0002223 # used to generate autocompletions from manpages and for configuration editing in the browser
24 usePython ? true,
···143144 fish = stdenv.mkDerivation rec {
145 pname = "fish";
146- version = "3.7.1";
147148- src = fetchurl {
149- # There are differences between the release tarball and the tarball GitHub
150- # packages from the tag. Specifically, it comes with a file containing its
151- # version, which is used in `build_tools/git_version_gen.sh` to determine
152- # the shell's actual version (and what it displays when running `fish
153- # --version`), as well as the local documentation for all builtins (and
154- # maybe other things).
155- url = "https://github.com/fish-shell/fish-shell/releases/download/${version}/${pname}-${version}.tar.xz";
156- hash = "sha256-YUyfVkPNB5nfOROV+mu8NklCe7g5cizjsRTTu8GjslA=";
000157 };
158159 patches = [
0000160 # We don’t want to run `/usr/libexec/path_helper` on nix-darwin,
161 # as it pulls in paths not tracked in the system configuration
162 # and messes up the order of `$PATH`. Upstream are unfortunately
···173 # Fix FHS paths in tests
174 postPatch =
175 ''
176- # src/fish_tests.cpp
177- sed -i 's|/bin/ls|${coreutils}/bin/ls|' src/fish_tests.cpp
178- sed -i 's|is_potential_path(L"/usr"|is_potential_path(L"/nix"|' src/fish_tests.cpp
179- sed -i 's|L"/bin/echo"|L"${coreutils}/bin/echo"|' src/fish_tests.cpp
180- sed -i 's|L"/bin/c"|L"${coreutils}/bin/c"|' src/fish_tests.cpp
181- sed -i 's|L"/bin/ca"|L"${coreutils}/bin/ca"|' src/fish_tests.cpp
182- # disable flakey test
183- sed -i '/{TEST_GROUP("history_races"), history_tests_t::test_history_races},/d' src/fish_tests.cpp
184185 # tests/checks/cd.fish
186 sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish
···224 ];
225 strictDeps = true;
226 nativeBuildInputs = [
0227 cmake
228 gettext
0000229 ];
230231 buildInputs = [
232- ncurses
233 libiconv
234 pcre2
235 ];
···255 preConfigure =
256 ''
257 patchShebangs ./build_tools/git_version_gen.sh
0258 ''
259 + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
260 export CMAKE_PREFIX_PATH=
···273274 nativeCheckInputs = [
275 coreutils
0276 (python3.withPackages (ps: [ ps.pexpect ]))
277 procps
278 ];
279280- checkPhase = ''
281- make test
00000000000000000282 '';
283284 postInstall =
···295 "$out/share/fish/functions/prompt_pwd.fish"
296 sed -i "s|nroff|${groff}/bin/nroff|" \
297 "$out/share/fish/functions/__fish_print_help.fish"
298- sed -e "s|clear;|${lib.getBin ncurses}/bin/clear;|" \
299- -i "$out/share/fish/functions/fish_default_key_bindings.fish"
300 sed -i "s|/usr/local/sbin /sbin /usr/sbin||" \
301 $out/share/fish/completions/{sudo.fish,doas.fish}
302 sed -e "s| awk | ${gawk}/bin/awk |" \
···366 # if we don't set `delete=False`, the file will get cleaned up
367 # automatically (leading the test to fail because there's no
368 # tempfile to check)
369- ${lib.getExe gnused} -e 's@, mode="w"@, mode="w", delete=False@' -i webconfig.py
370371 # we delete everything after the fileurl is assigned
372 ${lib.getExe gnused} -e '/fileurl =/q' -i webconfig.py
···1{
2 stdenv,
3 lib,
4+ fetchFromGitHub,
05 coreutils,
6+ glibcLocales,
7 gnused,
8 gnugrep,
9 groff,
10 gawk,
11 man-db,
12+ ninja,
13 getent,
14 libiconv,
15 pcre2,
16+ pkg-config,
17 gettext,
18 ncurses,
19 python3,
20+ cargo,
21 cmake,
22 fishPlugins,
23 procps,
24+ rustc,
25+ rustPlatform,
26+ versionCheckHook,
2728 # used to generate autocompletions from manpages and for configuration editing in the browser
29 usePython ? true,
···148149 fish = stdenv.mkDerivation rec {
150 pname = "fish";
151+ version = "4.0.0";
152153+ src = fetchFromGitHub {
154+ owner = "fish-shell";
155+ repo = "fish-shell";
156+ tag = version;
157+ hash = "sha256-BLbL5Tj3FQQCOeX5TWXMaxCpvdzZtKe5dDQi66uU/BM=";
158+ };
159+160+ env.FISH_BUILD_VERSION = version;
161+162+ cargoDeps = rustPlatform.fetchCargoVendor {
163+ inherit src;
164+ hash = "sha256-j1HCj1iZ5ZV8nfMmJq5ggPD4s+5V8IretDdoz+G3wWU=";
165 };
166167 patches = [
168+ # This test fails if the nix sandbox gets created on a filesystem that's
169+ # mounted with the nosuid option.
170+ ./disable_suid_test.patch
171+172 # We don’t want to run `/usr/libexec/path_helper` on nix-darwin,
173 # as it pulls in paths not tracked in the system configuration
174 # and messes up the order of `$PATH`. Upstream are unfortunately
···185 # Fix FHS paths in tests
186 postPatch =
187 ''
188+ sed -i 's|"/bin/ls"|"${lib.getExe' coreutils "ls"}"|' src/builtins/tests/test_tests.rs
189+ sed -i 's|"/bin/echo"|"${lib.getExe' coreutils "echo"}"|' src/tests/highlight.rs
190+ sed -i 's|"/bin/c"|"${lib.getExe' coreutils "c"}"|' src/tests/highlight.rs
191+ sed -i 's|"/bin/ca"|"${lib.getExe' coreutils "ca"}"|' src/tests/highlight.rs
192+193+ sed -i 's|/usr|/build|' src/tests/highlight.rs
00194195 # tests/checks/cd.fish
196 sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish
···234 ];
235 strictDeps = true;
236 nativeBuildInputs = [
237+ cargo
238 cmake
239 gettext
240+ ninja
241+ pkg-config
242+ rustc
243+ rustPlatform.cargoSetupHook
244 ];
245246 buildInputs = [
0247 libiconv
248 pcre2
249 ];
···269 preConfigure =
270 ''
271 patchShebangs ./build_tools/git_version_gen.sh
272+ patchShebangs ./tests/test_driver.py
273 ''
274 + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
275 export CMAKE_PREFIX_PATH=
···288289 nativeCheckInputs = [
290 coreutils
291+ glibcLocales
292 (python3.withPackages (ps: [ ps.pexpect ]))
293 procps
294 ];
295296+ checkTarget = "fish_run_tests";
297+ preCheck = ''
298+ export TERMINFO="${ncurses}/share/terminfo"
299+ '';
300+301+ nativeInstallCheckInputs = [
302+ versionCheckHook
303+ ];
304+ versionCheckProgramArg = [ "--version" ];
305+ doInstallCheck = true;
306+307+ # Ensure that we don't vendor libpcre2, but instead link against the one from nixpkgs
308+ installCheckPhase = lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
309+ runHook preInstallCheck
310+311+ echo "Checking that we don't vendor pcre2"
312+ ldd "$out/bin/fish" | grep ${lib.getLib pcre2}
313+314+ runHook postInstallCheck
315 '';
316317 postInstall =
···328 "$out/share/fish/functions/prompt_pwd.fish"
329 sed -i "s|nroff|${groff}/bin/nroff|" \
330 "$out/share/fish/functions/__fish_print_help.fish"
00331 sed -i "s|/usr/local/sbin /sbin /usr/sbin||" \
332 $out/share/fish/completions/{sudo.fish,doas.fish}
333 sed -e "s| awk | ${gawk}/bin/awk |" \
···397 # if we don't set `delete=False`, the file will get cleaned up
398 # automatically (leading the test to fail because there's no
399 # tempfile to check)
400+ ${lib.getExe gnused} -e 's@delete=True,@delete=False,@' -i webconfig.py
401402 # we delete everything after the fileurl is assigned
403 ${lib.getExe gnused} -e '/fileurl =/q' -i webconfig.py