* [PATCH] config: Add profile script for fish shell
@ 2024-03-21 15:04 Frederik “Freso” S. Olesen
2024-03-21 20:25 ` Mark Wielaard
2024-03-22 17:21 ` [PATCH v2] " Frederik “Freso” S. Olesen
0 siblings, 2 replies; 5+ messages in thread
From: Frederik “Freso” S. Olesen @ 2024-03-21 15:04 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 3527 bytes --]
Add support for setting $DEBUGINFOD_URLS automatically in the fish shell
similar to the profile scripts for POSIX and csh shells.
Makefile is set to install this into fish’s $XDG_DATA_DIRS vendor
directory instead of under /etc:
https://fishshell.com/docs/current/language.html#configuration-files
* config/profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
* config/Makefile.am: Include profile.fish in install and
uninstall targets.
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
---
config/ChangeLog | 5 +++++
config/Makefile.am | 5 ++++-
config/profile.fish.in | 14 ++++++++++++++
3 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 config/profile.fish.in
diff --git a/config/ChangeLog b/config/ChangeLog
index ce1f74f6..7d88c071 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2024-03-21 Frederik “Freso” S. Olesen <freso@freso.dk>
+
+ * profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
+ * Makefile.am: Include profile.fish in install and uninstall targets.
+
2023-02-21 Mark Wielaard <mark@klomp.org>
* eu.am (USE_AFTER_FREE3_WARNING): Define.
diff --git a/config/Makefile.am b/config/Makefile.am
index 0d3ba164..ae14e625 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -30,7 +30,8 @@
##
EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
libelf.pc.in libdw.pc.in libdebuginfod.pc.in \
- debuginfod.service debuginfod.sysconfig profile.sh.in profile.csh.in
+ debuginfod.service debuginfod.sysconfig \
+ profile.sh.in profile.csh.in profile.fish.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libelf.pc libdw.pc
@@ -40,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
+ $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod
if [ -n "@DEBUGINFOD_URLS@" ]; then \
echo "@DEBUGINFOD_URLS@" > $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls; \
@@ -48,6 +50,7 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+ rm -f $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
rm -f $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls
-rmdir $(DESTDIR)$(sysconfdir)/debuginfod
endif
diff --git a/config/profile.fish.in b/config/profile.fish.in
new file mode 100644
index 00000000..34b1ab85
--- /dev/null
+++ b/config/profile.fish.in
@@ -0,0 +1,14 @@
+# $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
+# If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
+# $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
+# See also [man debuginfod-client-config] for other environment variables
+# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
+
+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' ' ')
+ if test -n "$DEBUGINFOD_URLS"
+ set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
+ end
+end
--
2.44.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] config: Add profile script for fish shell
2024-03-21 15:04 [PATCH] config: Add profile script for fish shell Frederik “Freso” S. Olesen
@ 2024-03-21 20:25 ` Mark Wielaard
2024-03-22 10:13 ` Frederik “Freso” S. Olesen
2024-03-22 17:21 ` [PATCH v2] " Frederik “Freso” S. Olesen
1 sibling, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2024-03-21 20:25 UTC (permalink / raw)
To: Frederik “Freso” S. Olesen; +Cc: elfutils-devel
Hi,
On Thu, Mar 21, 2024 at 04:04:11PM +0100, Frederik “Freso” S. Olesen wrote:
> Add support for setting $DEBUGINFOD_URLS automatically in the fish shell
> similar to the profile scripts for POSIX and csh shells.
>
> Makefile is set to install this into fish’s $XDG_DATA_DIRS vendor
> directory instead of under /etc:
> https://fishshell.com/docs/current/language.html#configuration-files
>
> * config/profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
> * config/Makefile.am: Include profile.fish in install and
> uninstall targets.
Very nice. I don't know fish, but this looks reasonable.
Two small comments below.
> Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
> ---
> config/ChangeLog | 5 +++++
> config/Makefile.am | 5 ++++-
> config/profile.fish.in | 14 ++++++++++++++
> 3 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 config/profile.fish.in
>
> diff --git a/config/ChangeLog b/config/ChangeLog
> index ce1f74f6..7d88c071 100644
> --- a/config/ChangeLog
> +++ b/config/ChangeLog
> @@ -1,3 +1,8 @@
> +2024-03-21 Frederik “Freso” S. Olesen <freso@freso.dk>
> +
> + * profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
> + * Makefile.am: Include profile.fish in install and uninstall targets.
Since we have been putting the ChangeLog entry into the commit message
it doesn't need to also go into the actual Changelog file.
> 2023-02-21 Mark Wielaard <mark@klomp.org>
>
> * eu.am (USE_AFTER_FREE3_WARNING): Define.
> diff --git a/config/Makefile.am b/config/Makefile.am
> index 0d3ba164..ae14e625 100644
> --- a/config/Makefile.am
> +++ b/config/Makefile.am
> @@ -30,7 +30,8 @@
> ##
> EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
> libelf.pc.in libdw.pc.in libdebuginfod.pc.in \
> - debuginfod.service debuginfod.sysconfig profile.sh.in profile.csh.in
> + debuginfod.service debuginfod.sysconfig \
> + profile.sh.in profile.csh.in profile.fish.in
>
> pkgconfigdir = $(libdir)/pkgconfig
> pkgconfig_DATA = libelf.pc libdw.pc
> @@ -40,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
> + $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
> mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod
> if [ -n "@DEBUGINFOD_URLS@" ]; then \
> echo "@DEBUGINFOD_URLS@" > $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls; \
> @@ -48,6 +50,7 @@ install-data-local:
> uninstall-local:
> rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
> rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
> + rm -f $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
> rm -f $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls
> -rmdir $(DESTDIR)$(sysconfdir)/debuginfod
> endif
Right, with --prefix=/usr that expands to
/usr/share/fish/vendor_conf.d which seems to match the default install
location you pointed out above. Good.
> diff --git a/config/profile.fish.in b/config/profile.fish.in
> new file mode 100644
> index 00000000..34b1ab85
> --- /dev/null
> +++ b/config/profile.fish.in
> @@ -0,0 +1,14 @@
> +# $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
> +# If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
> +# $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
> +# See also [man debuginfod-client-config] for other environment variables
> +# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
> +
> +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' ' ')
> + if test -n "$DEBUGINFOD_URLS"
> + set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
> + end
> +end
I don't know fish, but this looks OK.
Note that to turn this profile.fish.in into profile.fish you need to
mark it as a config file in configure.ac:
diff --git a/configure.ac b/configure.ac
index 098d13067ee6..a279bb5282c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -881,7 +881,7 @@ AC_ARG_ENABLE(debuginfod-urls,
fi],
[default_debuginfod_urls=""])
AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)
-AC_CONFIG_FILES([config/profile.sh config/profile.csh])
+AC_CONFIG_FILES([config/profile.sh config/profile.csh config/profile.fish])
AC_OUTPUT
Could you sent a new patch with those two changes?
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] config: Add profile script for fish shell
2024-03-21 20:25 ` Mark Wielaard
@ 2024-03-22 10:13 ` Frederik “Freso” S. Olesen
0 siblings, 0 replies; 5+ messages in thread
From: Frederik “Freso” S. Olesen @ 2024-03-22 10:13 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 3668 bytes --]
On Thu, Mar 21, 2024 at 09:25:36PM +0100, Mark Wielaard wrote:
> Hi,
Hi! Thanks for the review! Comments below and revision coming up :)
> On Thu, Mar 21, 2024 at 04:04:11PM +0100, Frederik “Freso” S. Olesen wrote:
> > diff --git a/config/ChangeLog b/config/ChangeLog
> > index ce1f74f6..7d88c071 100644
> > --- a/config/ChangeLog
> > +++ b/config/ChangeLog
> > @@ -1,3 +1,8 @@
> > +2024-03-21 Frederik “Freso” S. Olesen <freso@freso.dk>
> > +
> > + * profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
> > + * Makefile.am: Include profile.fish in install and uninstall targets.
>
> Since we have been putting the ChangeLog entry into the commit message
> it doesn't need to also go into the actual Changelog file.
Yeah, I wasn’t sure since it seemed like some recent(ish) commits still
put in ChangeLog entries, but CONTRIBUTORS said not to… so I opted to
just include this and it would be easy to either exclude when applying
the patch or remove in a revision. I’ll do the latter. :)
> > <snip>
> > + $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
> > <snip>
> > + rm -f $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
>
> Right, with --prefix=/usr that expands to
> /usr/share/fish/vendor_conf.d which seems to match the default install
> location you pointed out above. Good.
Yeah, I had to look up the directory variables to figure out where to put
it, to not just go for the “lazy” way of placing it in /etc:
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
> > diff --git a/config/profile.fish.in b/config/profile.fish.in
> > new file mode 100644
> > index 00000000..34b1ab85
> > --- /dev/null
> > +++ b/config/profile.fish.in
> > @@ -0,0 +1,14 @@
> > +# $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
> > +# If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
> > +# $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
> > +# See also [man debuginfod-client-config] for other environment variables
> > +# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
> > +
> > +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' ' ')
> > + if test -n "$DEBUGINFOD_URLS"
> > + set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
> > + end
> > +end
>
> I don't know fish, but this looks OK.
I’ve been running this locally (but under $XDG_CONFIG_HOME)
since yesterday and it works well for me, with elfutils.urls
and archlinux.urls under /etc.
That said, I just spotted a mistake in my code, which I have missed
because that line is removed in my locally running version:
Fish’s `set` doesn’t use `=` for assignment, so the `$prefix` assignment
needs a tiny fix too.
> Note that to turn this profile.fish.in into profile.fish you need to
> mark it as a config file in configure.ac:
Ah! I’ve been having some SIGILL problems with `git grep`[1] so I missed
looking for other places where the other profile.*sh’s were mentioned.
[1] Incidentally, the attempt at debugging this issue is how I realised
that $DEBUGINFOD_URLS was _not_ automatically populated in fish… which
led me down the rabbit hole ending in this patch. 😅
> Could you sent a new patch with those two changes?
Yes, coming right up!
--
Solidarity,
Frederik “Freso” S. Olesen <https://freso.dk/>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] config: Add profile script for fish shell
2024-03-21 15:04 [PATCH] config: Add profile script for fish shell Frederik “Freso” S. Olesen
2024-03-21 20:25 ` Mark Wielaard
@ 2024-03-22 17:21 ` Frederik “Freso” S. Olesen
2024-03-24 16:59 ` Mark Wielaard
1 sibling, 1 reply; 5+ messages in thread
From: Frederik “Freso” S. Olesen @ 2024-03-22 17:21 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 3552 bytes --]
Add support for setting $DEBUGINFOD_URLS automatically in the fish shell
similar to the profile scripts for POSIX and csh shells.
Makefile is set to install this into fish’s $XDG_DATA_DIRS vendor
directory instead of under /etc:
https://fishshell.com/docs/current/language.html#configuration-files
* config/profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
* configure.ac, config/Makefile.am: Include profile.fish in
install and uninstall targets.
Signed-off-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com>
---
config/Makefile.am | 5 ++++-
config/profile.fish.in | 14 ++++++++++++++
configure.ac | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
create mode 100644 config/profile.fish.in
diff --git a/config/Makefile.am b/config/Makefile.am
index 0d3ba164..ae14e625 100644
--- a/config/Makefile.am
+++ b/config/Makefile.am
@@ -30,7 +30,8 @@
##
EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
libelf.pc.in libdw.pc.in libdebuginfod.pc.in \
- debuginfod.service debuginfod.sysconfig profile.sh.in profile.csh.in
+ debuginfod.service debuginfod.sysconfig \
+ profile.sh.in profile.csh.in profile.fish.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libelf.pc libdw.pc
@@ -40,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
+ $(INSTALL_DATA) profile.fish -D $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod
if [ -n "@DEBUGINFOD_URLS@" ]; then \
echo "@DEBUGINFOD_URLS@" > $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls; \
@@ -48,6 +50,7 @@ install-data-local:
uninstall-local:
rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+ rm -f $(DESTDIR)$(datadir)/fish/vendor_conf.d/debuginfod.fish
rm -f $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls
-rmdir $(DESTDIR)$(sysconfdir)/debuginfod
endif
diff --git a/config/profile.fish.in b/config/profile.fish.in
new file mode 100644
index 00000000..00e9ca59
--- /dev/null
+++ b/config/profile.fish.in
@@ -0,0 +1,14 @@
+# $HOME/.profile* or similar files may first set $DEBUGINFOD_URLS.
+# If $DEBUGINFOD_URLS is not set there, we set it from system *.url files.
+# $HOME/.*rc or similar files may then amend $DEBUGINFOD_URLS.
+# See also [man debuginfod-client-config] for other environment variables
+# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS.
+
+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' ' ')
+ if test -n "$DEBUGINFOD_URLS"
+ set --global --export DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
+ end
+end
diff --git a/configure.ac b/configure.ac
index 098d1306..a279bb52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -881,7 +881,7 @@ AC_ARG_ENABLE(debuginfod-urls,
fi],
[default_debuginfod_urls=""])
AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)
-AC_CONFIG_FILES([config/profile.sh config/profile.csh])
+AC_CONFIG_FILES([config/profile.sh config/profile.csh config/profile.fish])
AC_OUTPUT
--
2.44.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] config: Add profile script for fish shell
2024-03-22 17:21 ` [PATCH v2] " Frederik “Freso” S. Olesen
@ 2024-03-24 16:59 ` Mark Wielaard
0 siblings, 0 replies; 5+ messages in thread
From: Mark Wielaard @ 2024-03-24 16:59 UTC (permalink / raw)
To: Frederik “Freso” S. Olesen; +Cc: elfutils-devel
Hi Freso,
On Fri, Mar 22, 2024 at 06:21:04PM +0100, Frederik “Freso” S. Olesen wrote:
> Add support for setting $DEBUGINFOD_URLS automatically in the fish shell
> similar to the profile scripts for POSIX and csh shells.
>
> Makefile is set to install this into fish’s $XDG_DATA_DIRS vendor
> directory instead of under /etc:
> https://fishshell.com/docs/current/language.html#configuration-files
>
> * config/profile.fish.in: Set $DEBUGINFOD_URLS in fish shells.
> * configure.ac, config/Makefile.am: Include profile.fish in
> install and uninstall targets.
Looks good. Pushed.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-24 16:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21 15:04 [PATCH] config: Add profile script for fish shell Frederik “Freso” S. Olesen
2024-03-21 20:25 ` Mark Wielaard
2024-03-22 10:13 ` Frederik “Freso” S. Olesen
2024-03-22 17:21 ` [PATCH v2] " Frederik “Freso” S. Olesen
2024-03-24 16:59 ` Mark Wielaard
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).