summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorнаб via Elfutils-devel <elfutils-devel@sourceware.org>2022-01-19 13:31:35 +0100
committerMark Wielaard <mark@klomp.org>2022-04-23 02:29:18 +0200
commit7b046b7c060acc32c00748ee66ac350f77bc6571 (patch)
tree58babc0feab569c5b82a398c7498c44f3a70fa7a
parent21fa92319657ca479ae108967fd41ac523a2f876 (diff)
downloadelfutils-7b046b7c060acc32c00748ee66ac350f77bc6571.tar.gz
config: simplify profile.*sh.in
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>
-rw-r--r--config/ChangeLog7
-rw-r--r--config/profile.csh.in10
-rw-r--r--config/profile.sh.in9
3 files changed, 14 insertions, 12 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index d2d61c6c..b9b1c44e 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -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
diff --git a/config/profile.csh.in b/config/profile.csh.in
index 01f7c2f2..012e243a 100644
--- a/config/profile.csh.in
+++ b/config/profile.csh.in
@@ -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
diff --git a/config/profile.sh.in b/config/profile.sh.in
index afce3963..bad20b1e 100644
--- a/config/profile.sh.in
+++ b/config/profile.sh.in
@@ -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