From: наб via Elfutils-devel Date: Wed, 19 Jan 2022 12:31:35 +0000 (+0100) Subject: config: simplify profile.*sh.in X-Git-Tag: elfutils-0.187~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b046b7c060acc32c00748ee66ac350f77bc6571;p=thirdparty%2Felfutils.git 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 --- 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