Hi,
On Tue, Nov 03, 2020 at 06:26:07PM +0100, Mark Wielaard wrote:
> Hi Frank,
>
> On Tue, 2020-11-03 at 12:07 -0500, Frank Ch. Eigler via Elfutils-devel
> wrote:
> > > While packaging I noticed that we install the profiles.d files even
> > > when the DEBUGINFOD_URLS is empty. I think we should avoid that.
> >
> > I think we should install them anyway. They give a sysadmin an easy
> > knob to set a systemwide default, even if the distro build didn't.
>
> That is a good point. But I think the default setting is wrong if it
> isn't actually used/setup. As the profile shell snippets are now they
> define the DEBUGINFOD_URLS environment variable as an non-empty string
> (although just containing spaces), which makes anything using
> libdw/libdebuginfod do extra work because we have to assume there is
> some server defined.
>
> Is there a way to make it so that even if the profiles are installed
> the DEBUGINFOD_URLS is not defined or is the empty string if --enable-
> debuginfod-urls isn't given?
Something like this?
diff --git a/config/profile.sh.in b/config/profile.sh.in
index 8a022489..aa228a0d 100644
--- a/config/profile.sh.in
+++ b/config/profile.sh.in
@@ -1,3 +1,4 @@
-
-DEBUGINFOD_URLS="$DEBUGINFOD_URLS @DEBUGINFOD_URLS@"
-export DEBUGINFOD_URLS
+if [ -n "@DEBUGINFOD_URLS@" ]; then
+ DEBUGINFOD_URLS="${DEBUGINFOD_URLS-}${DEBUGINFOD_URLS:+
}@DEBUGINFOD_URLS@"
+ export DEBUGINFOD_URLS
+fi
--
ldv