From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tarta.nabijaczleweli.xyz (unknown [139.28.40.42]) by sourceware.org (Postfix) with ESMTP id D08B83858C27 for ; Wed, 19 Jan 2022 12:31:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D08B83858C27 Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 820FC2970; Wed, 19 Jan 2022 13:31:36 +0100 (CET) Date: Wed, 19 Jan 2022 13:31:35 +0100 From: =?utf-8?B?0L3QsNCx?= To: "Frank Ch. Eigler" Cc: elfutils-devel@sourceware.org Subject: [PATCH v2] config: simplify profile.*sh.in Message-ID: <20220119123135.kb76gutv42itxant@tarta.nabijaczleweli.xyz> References: <20220117162219.fqt7heu4j67fzq35@tarta.nabijaczleweli.xyz> <20220118161328.GB21016@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qhkzdaktfnktu2aq" Content-Disposition: inline In-Reply-To: <20220118161328.GB21016@redhat.com> User-Agent: NeoMutt/20211029 X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FROM_SUSPICIOUS_NTLD, GIT_PATCH_0, KAM_INFOUSMEBIZ, PDS_OTHER_BAD_TLD, PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jan 2022 12:31:41 -0000 --qhkzdaktfnktu2aq Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! On Tue, Jan 18, 2022 at 11:13:28AM -0500, Frank Ch. Eigler wrote: > You mean "prefix=3D@prefix@". And it's not needless, > because @sysconfdir@ often expands to "$prefix/something", > which requires a prefix var to be set for evaluation. I did, and yeah, that's right. Guess it was so outlandish that I completely missed it. Dropped. > > 2. Simplify needless sh -c "cat glob 2>/dev/null" > > into cat glob 2>/dev/null > This is not needless, but I forget the exact details. It probably has > to do with the $prefix expansion just above, or perhaps glob > non-matching error handling. Well, no, as-written, it is needless. It's also incorrect, since it's subject to word-splitting (=3D> a broken glob) again. But, yeah, turns out csh does have "glob non-matching error handing", which is both news to me and a blast from a V3-era past. That being said, it was also broken, because under csh false | cat fails, for some inexplicable reason, and if the glob "fails", so does cat, so so does sh. I've restored it, in a fashion that isn't subject to re-splitting, and actually protects -e mode, for csh. v2 scissor-patch below. Please keep me in CC, as I'm not subscribed, =D0=BD=D0=B0=D0=B1 -- >8 -- 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 D_U directly and either export it or unset it Signed-off-by: Ahelenia Ziemia=C5=84ska --- config/profile.csh.in | 10 +++++----- config/profile.sh.in | 9 ++------- 2 files changed, 7 insertions(+), 12 deletions(-) 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 @@ =20 if (! $?DEBUGINFOD_URLS) then set prefix=3D"@prefix@" - set debuginfod_urls=3D`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/de= v/null" | tr '\n' ' '` - if ( "$debuginfod_urls" !=3D "" ) then - setenv DEBUGINFOD_URLS "$debuginfod_urls" + set DEBUGINFOD_URLS=3D`sh -c 'cat "$0"/*.urls; :' "@sysconfdir@/debugi= nfod" 2>/dev/null | tr '\n' ' '` + if ( "$DEBUGINFOD_URLS" !=3D "" ) 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 @@ =20 if [ -z "$DEBUGINFOD_URLS" ]; then prefix=3D"@prefix@" - debuginfod_urls=3D`sh -c "cat @sysconfdir@/debuginfod/*.urls 2>/dev/nu= ll" | tr '\n' ' '` - if [ -n "$debuginfod_urls" ]; then - DEBUGINFOD_URLS=3D"$debuginfod_urls" - export DEBUGINFOD_URLS - fi - unset debuginfod_urls + DEBUGINFOD_URLS=3D$(cat "@sysconfdir@/debuginfod"/*.urls 2>/dev/null |= tr '\n' ' ') + [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset DEBUGINFO= D_URLS unset prefix fi --=20 2.34.1 --qhkzdaktfnktu2aq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEfWlHToQCjFzAxEFjvP0LAY0mWPEFAmHoBKQACgkQvP0LAY0m WPFnGA/9H+1G3eOv5JbJXHir60kGD7vccNHHajMhdPyggZEc5M0AVcBcNr2IuhE+ loJFWL8mSTi4nej+TIQQkZPTCqFKHH4vVmrZlA9am2g7zQ38wUB+dUbnJ6rb7gqd sab3X/ZxqNCXmUS+qIdJtuHl2Jb3wvFYWUxzUckZZdN8tD8rP9aiRtXLE3HQ0wnL 7g3YLprhi5D1VOigOmZi65IogB7rsUTvxEvYb1YaApYlkPdw5EBoMwF6k2TED3lX HVBluAtt+GPlx7LuV905Y+ORilmbZSo4r2KP+17WQFGWcaEqNvJpNOt8aLxfArd3 e0u8Sppo4P4zzV1VO1GfxjPPJTxJhmkRf8AfjG3hP15nDbU8JSHDkaZrXteZdyeM QPMGu8oQDR4orb7cAW49gOE08h4itl0I+hRQiKN7ZXCFDvFMh8dU8tGgfli0y+PV 3EJOg8hHmup0l+G0830IQwogynDZJynles4Lg83d1AiT29dpSmj0kHK0b9gcgGZB ZV9J+RParY3/sO5MwGxjCoWiH7oZ6HOPVtfSHq0plHvE7a0GeQO3zzXexM11ni5H qMB2uNE0dyEsAvcEoynAFs87SkhAWXVz3AmM6b2cQGJ+YPVZVvMwW9HwrQFjE03+ BlD2vEpHXa+xvDc/0axEmzbBARCPHwr64g4cM3Ri8ZPJxzLSm3Q= =wfHw -----END PGP SIGNATURE----- --qhkzdaktfnktu2aq--