fish: avoid replacing "awk" in store paths

We encountered a fish build failure [1] caused by the store path for
gnugrep coincidentally containing the string `awk`. A later substitution
of `awk` replaced this substring with another store path in some files,
resulting in a number of broken paths.

Extending the `awk` pattern to `awk ` solves this problem and should be
relatively safe given that awk requires arguments to be passed.

[1] https://hydra.nixos.org/build/343861659

(cherry picked from commit c1d634b292)
This commit is contained in:
Tom Hunze
2026-08-29 21:53:25 +02:00
committed by github-actions[bot]
parent 50093e8c76
commit 00aafcb7d3

View File

@@ -254,14 +254,16 @@ stdenv.mkDerivation (finalAttrs: {
EOF
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
# Trailing space in 'awk ' to avoid matching store paths that coincidentally
# contain the string 'awk'. (Yes, this has happened before!)
for cur in share/functions/*.fish; do
substituteInPlace "$cur" \
--replace-quiet '/usr/bin/getent' '${lib.getExe getent}' \
--replace-quiet 'awk' '${lib.getExe' gawk "awk"}'
--replace-quiet 'awk ' '${lib.getExe' gawk "awk"} '
done
for cur in share/completions/*.fish; do
substituteInPlace "$cur" \
--replace-quiet 'awk' '${lib.getExe' gawk "awk"}'
--replace-quiet 'awk ' '${lib.getExe' gawk "awk"} '
done
''
+ ''