]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors
authorAaron Merey <amerey@redhat.com>
Tue, 16 Apr 2024 15:49:43 +0000 (11:49 -0400)
committerAaron Merey <amerey@redhat.com>
Wed, 17 Apr 2024 18:37:59 +0000 (14:37 -0400)
Fish does not support bracketed variables in scripts.  Remove brackets
from the variable ${prefix} in profile.fish before installation to
prevent this error.

Fish also raises an error for unmatched wildcards, except for special
cases like the set command.  Use a wildcard to match .urls files using
the set command instead of cat to prevent an unmatched wildcard error
when no .urls files are found.

Signed-off-by: Aaron Merey <amerey@redhat.com>
config/Makefile.am
config/profile.fish.in
tests/run-debuginfod-client-profile.sh

index ae14e625b726a3b16f0dfda0e3b1d19b043b54b5..fd41997f17517f85dcf1190e163ce7ba502ed2f3 100644 (file)
@@ -41,6 +41,7 @@ pkgconfig_DATA += libdebuginfod.pc
 install-data-local:
        $(INSTALL_DATA) profile.sh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
        $(INSTALL_DATA) profile.csh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+       sed -i 's/{prefix}/prefix/g' profile.fish
        $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
        mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod
        if [ -n "@DEBUGINFOD_URLS@" ]; then \
index 00e9ca596187700e61f5bcc612a4b71aed3a1928..c0a234dbea7773a0a5755a877de4950d7610dc5d 100644 (file)
@@ -7,7 +7,8 @@
 if not set --query DEBUGINFOD_URLS
     # Use local variables so we don't need to manually unset them
     set --local prefix "@prefix@"
-    set --local DEBUGINFOD_URLS (cat /dev/null "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | string replace '\n' ' ')
+    set --local files "@sysconfdir@/debuginfod/"*.urls
+    set --local DEBUGINFOD_URLS (cat /dev/null $files 2>/dev/null | string replace '\n' ' ')
     if test -n "$DEBUGINFOD_URLS"
         set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
     end
index 141588d391ea39bd97520254b76ca123bf3e0384..12f5a83b24c698edd5b6fc7811ef55acc52351a9 100755 (executable)
@@ -25,3 +25,6 @@ set -e
 set -o pipefail
 
 source ${abs_top_builddir}/config/profile.sh
+
+type fish 2>/dev/null || (echo "no fish installed"; exit 77)
+fish ${abs_top_builddir}/config/profile.fish