From 7b046b7c060acc32c00748ee66ac350f77bc6571 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=BD=D0=B0=D0=B1=20via=20Elfutils-devel?= Date: Wed, 19 Jan 2022 13:31:35 +0100 Subject: [PATCH] config: simplify profile.*sh.in MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- config/ChangeLog | 7 +++++++ config/profile.csh.in | 10 +++++----- config/profile.sh.in | 9 ++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/config/ChangeLog b/config/ChangeLog index d2d61c6c8..b9b1c44e0 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,10 @@ +2022-01-19 Ahelenia Ziemiańska + + * 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 * elfutils.spec.in (debuginfod-client): Add an explicit requires diff --git a/config/profile.csh.in b/config/profile.csh.in index 01f7c2f29..012e243ad 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 afce39634..bad20b1e3 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 -- 2.47.2