* [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors
@ 2024-03-26 23:52 Aaron Merey
2024-03-27 14:06 ` Mark Wielaard
0 siblings, 1 reply; 4+ messages in thread
From: Aaron Merey @ 2024-03-26 23:52 UTC (permalink / raw)
To: elfutils-devel; +Cc: Aaron Merey
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 | 1 +
config/profile.fish.in | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/config/Makefile.am b/config/Makefile.am
index ae14e625..fd41997f 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -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 \
diff --git a/config/profile.fish.in b/config/profile.fish.in
index 00e9ca59..c0a234db 100644
--- a/config/profile.fish.in
+++ b/config/profile.fish.in
@@ -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
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors
2024-03-26 23:52 [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors Aaron Merey
@ 2024-03-27 14:06 ` Mark Wielaard
2024-03-30 11:32 ` Frederik “Freso” S. Olesen
0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2024-03-27 14:06 UTC (permalink / raw)
To: Aaron Merey; +Cc: elfutils-devel, Frederik “Freso” S. Olesen
Hi Aaron,
Adding Freso to the CC since he is the original author of the fish
support.
On Tue, Mar 26, 2024 at 07:52:49PM -0400, Aaron Merey wrote:
> 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.
Not knowing fish this looks OK to me. We might want a testcase like
the one that was just added for config/profile.sh to make sure we ship
something that runs correctly. Could be something as simple as:
type fish 2>/dev/null || (echo "no fish installed"; exit 77)
fish ${abs_top_builddir}/config/profile.fish
> Signed-off-by: Aaron Merey <amerey@redhat.com>
> ---
> config/Makefile.am | 1 +
> config/profile.fish.in | 3 ++-
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/config/Makefile.am b/config/Makefile.am
> index ae14e625..fd41997f 100644
> --- a/config/Makefile.am
> +++ b/config/Makefile.am
> @@ -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 \
> diff --git a/config/profile.fish.in b/config/profile.fish.in
> index 00e9ca59..c0a234db 100644
> --- a/config/profile.fish.in
> +++ b/config/profile.fish.in
> @@ -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
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors
2024-03-27 14:06 ` Mark Wielaard
@ 2024-03-30 11:32 ` Frederik “Freso” S. Olesen
2024-04-17 18:46 ` Aaron Merey
0 siblings, 1 reply; 4+ messages in thread
From: Frederik “Freso” S. Olesen @ 2024-03-30 11:32 UTC (permalink / raw)
To: elfutils-devel
On Wed, Mar 27, 2024 at 03:06:48PM +0100, Mark Wielaard wrote:
> Adding Freso to the CC since he is the original author of the fish
> support.
Looks good to me! I don’t want to claim any specific authorship
or special knowledge of it. I basically just adapted the existing
bash/.sh profile script for local use and then retrofitted that
for upstream submission. I’m happy that other fish users are
contributing to improving it! :)
--
Solidarity,
Frederik “Freso” S. Olesen <https://freso.dk/>
– and Free Palestine!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors
2024-03-30 11:32 ` Frederik “Freso” S. Olesen
@ 2024-04-17 18:46 ` Aaron Merey
0 siblings, 0 replies; 4+ messages in thread
From: Aaron Merey @ 2024-04-17 18:46 UTC (permalink / raw)
To: Mark Wielaard; +Cc: elfutils-devel, Frederik “Freso” S. Olesen
On Wed, Mar 27, 2024 at 10:06 AM Mark Wielaard <mark@klomp.org> wrote:
>
> Not knowing fish this looks OK to me. We might want a testcase like
> the one that was just added for config/profile.sh to make sure we ship
> something that runs correctly. Could be something as simple as:
>
> type fish 2>/dev/null || (echo "no fish installed"; exit 77)
> fish ${abs_top_builddir}/config/profile.fish
On Sat, Mar 30, 2024 at 7:32 AM Frederik “Freso” S. Olesen
<freso.dk@gmail.com> wrote:
>
> On Wed, Mar 27, 2024 at 03:06:48PM +0100, Mark Wielaard wrote:
> > Adding Freso to the CC since he is the original author of the fish
> > support.
>
> Looks good to me! I don’t want to claim any specific authorship
> or special knowledge of it. I basically just adapted the existing
> bash/.sh profile script for local use and then retrofitted that
> for upstream submission. I’m happy that other fish users are
> contributing to improving it! :)
Thanks, pushed as commit eeea53b41b12dc9633ce6a3b1eb5c7d0ba0e057f
with Mark's testcase added.
Aaron
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-17 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 23:52 [PATCH] config/profile.fish.in: Prevent bracketed variables and unmatched wildcard errors Aaron Merey
2024-03-27 14:06 ` Mark Wielaard
2024-03-30 11:32 ` Frederik “Freso” S. Olesen
2024-04-17 18:46 ` Aaron Merey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).