]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
config: simplify profile.*sh.in
authorнаб via Elfutils-devel <elfutils-devel@sourceware.org>
Wed, 19 Jan 2022 12:31:35 +0000 (13:31 +0100)
committerMark Wielaard <mark@klomp.org>
Sat, 23 Apr 2022 00:29:18 +0000 (02:29 +0200)
1. Simplify needless sh -c "cat glob 2>/dev/null"
   into cat glob 2>/dev/null under sh
   and fix re-expansion/-e protection under csh
2. Use $( instead of ` under sh
3. Assign to DEBUGINFOD_URLS directly and either export it or unset it

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
config/ChangeLog
config/profile.csh.in
config/profile.sh.in

index d2d61c6c828fde3a77597414fb3fecc8024ea4cd..b9b1c44e0dcaf9d2ae0add10296e42e7cea315f8 100644 (file)
@@ -1,3 +1,10 @@
+2022-01-19  Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
+
+       * profile.csh.in: Set DEBUGINFOD_URLS directly. Use "$0" and :
+       in sh -c.
+       * profile.sh.in: Set DEBUGINFOD_URLS directly. Don't use sh -c.
+       Use $() instead of ``.
+
 2022-04-07  Mark Wielaard  <mark@klomp.org>
 
        * elfutils.spec.in (debuginfod-client): Add an explicit requires
index 01f7c2f29157bca658507f9d122c91a25d3c7224..012e243ad28d3399547a1302899fcba3573b213b 100644 (file)
@@ -1,4 +1,3 @@
-
 # $HOME/.login* 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.
@@ -7,10 +6,11 @@
 
 if (! $?DEBUGINFOD_URLS) then
     set prefix="@prefix@"
-    set debuginfod_urls=`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/dev/null" | tr '\n' ' '`
-    if ( "$debuginfod_urls" != "" ) then
-        setenv DEBUGINFOD_URLS "$debuginfod_urls"
+    set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls; :' "@sysconfdir@/debuginfod" 2>/dev/null | tr '\n' ' '`
+    if ( "$DEBUGINFOD_URLS" != "" ) then
+        setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
+    else
+        unset DEBUGINFOD_URLS
     endif
-    unset debuginfod_urls
     unset prefix
 endif
index afce3963492c7e9b506a304850cd8a76742af457..bad20b1e3836abab7b143a78f31d33a075c588ca 100644 (file)
@@ -1,4 +1,3 @@
-
 # $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.
@@ -7,11 +6,7 @@
 
 if [ -z "$DEBUGINFOD_URLS" ]; then
     prefix="@prefix@"
-    debuginfod_urls=`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/dev/null" | tr '\n' ' '`
-    if [ -n "$debuginfod_urls" ]; then
-        DEBUGINFOD_URLS="$debuginfod_urls"
-        export DEBUGINFOD_URLS
-    fi
-    unset debuginfod_urls
+    DEBUGINFOD_URLS=$(cat "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr '\n' ' ')
+    [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFOD_URLS
     unset prefix
 fi