From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id B1DE33858D3C for ; Sun, 3 Oct 2021 21:33:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B1DE33858D3C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-PCIeKvbnOFSCTQ4B0EQ-AA-1; Sun, 03 Oct 2021 17:33:38 -0400 X-MC-Unique: PCIeKvbnOFSCTQ4B0EQ-AA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D99C362F8 for ; Sun, 3 Oct 2021 21:33:37 +0000 (UTC) Received: from redhat.com (ovpn-112-152.phx2.redhat.com [10.3.112.152]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D7CC5F4EA for ; Sun, 3 Oct 2021 21:33:37 +0000 (UTC) Received: from fche by redhat.com with local (Exim 4.94.2) (envelope-from ) id 1mX96z-0005S3-Eg for elfutils-devel@sourceware.org; Sun, 03 Oct 2021 17:33:33 -0400 Date: Sun, 3 Oct 2021 17:33:33 -0400 From: "Frank Ch. Eigler" To: elfutils-devel@sourceware.org Subject: [patch] PR27783: default debuginfod-urls profile rework Message-ID: <20211003213333.GC21634@redhat.com> MIME-Version: 1.0 User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: Sun, 03 Oct 2021 21:33:44 -0000 commit 0c634f243d266ce8841fd311433d5d79555fabf9 Author: Frank Ch. Eigler Date: Sun Oct 3 17:04:24 2021 -0400 PR27783: switch default debuginfod-urls to drop-in style files Rewrote and commented the /etc/profile.d csh and sh script fragments to take the default $DEBUGINFOD_URLS from the union of drop-in files: /etc/debuginfod/*.urls. Hand-tested with csh and bash, with conditions including no prior $DEBUGINFOD_URLS, nonexistent .urls files, multiple entries in .urls files. Signed-off-by: Frank Ch. Eigler diff --git a/config/ChangeLog b/config/ChangeLog index b2c0af8ac816..bd41654f5492 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,11 @@ +2021-10-03 Frank Ch. Eigler + + PR27783 + * profile.sh, profile.csh: Rewrite to document and set DEBUGINFOD_URLS + from /etc/debuginfod/*.urls files. + * Makefile.am: Install the configury-specified .urls file. + * elfutils.spec: Package it. + 2021-09-05 Dmitry V. Levin * eu.am (STACK_USAGE_NO_ERROR): New variable. diff --git a/config/Makefile.am b/config/Makefile.am index a66f54904991..0d3ba164ee3a 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -40,9 +40,16 @@ pkgconfig_DATA += libdebuginfod.pc install-data-local: $(INSTALL_DATA) profile.sh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh $(INSTALL_DATA) profile.csh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh + mkdir -p $(DESTDIR)$(sysconfdir)/debuginfod + if [ -n "@DEBUGINFOD_URLS@" ]; then \ + echo "@DEBUGINFOD_URLS@" > $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls; \ + fi uninstall-local: - rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh + rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh + rm -f $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh + rm -f $(DESTDIR)$(sysconfdir)/debuginfod/elfutils.urls + -rmdir $(DESTDIR)$(sysconfdir)/debuginfod endif if MAINTAINER_MODE diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in index 043762653c90..8f6a8e03202f 100644 --- a/config/elfutils.spec.in +++ b/config/elfutils.spec.in @@ -301,6 +301,7 @@ fi %{_mandir}/man1/debuginfod-find.1* %{_mandir}/man7/debuginfod*.7* %config(noreplace) %{_sysconfdir}/profile.d/* +%config(noreplace) %{_sysconfdir}/debuginfod/* %files debuginfod-client-devel %defattr(-,root,root) diff --git a/config/profile.csh.in b/config/profile.csh.in index 0a2d6d162019..29e59a709450 100644 --- a/config/profile.csh.in +++ b/config/profile.csh.in @@ -1,11 +1,16 @@ -if ("@DEBUGINFOD_URLS@" != "") then - if ($?DEBUGINFOD_URLS) then - if ($%DEBUGINFOD_URLS) then - setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS @DEBUGINFOD_URLS@" - else - setenv DEBUGINFOD_URLS "@DEBUGINFOD_URLS@" - endif - else - setenv DEBUGINFOD_URLS "@DEBUGINFOD_URLS@" - endif + +# $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. +# See also [man debuginfod-client-config] for other environment variables +# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS. + +if (! $?DEBUGINFOD_URLS) then + set prefix="@prefix@" + set debuginfod_urls=`find "@sysconfdir@/debuginfod/" -name '*.urls' | xargs cat | tr '\n' ' '` + if ( "$debuginfod_urls" != "" ) then + setenv DEBUGINFOD_URLS "$debuginfod_urls" + endif + unset debuginfod_urls + unset prefix endif diff --git a/config/profile.sh.in b/config/profile.sh.in index aa228a0dcd16..94b2983b9f90 100644 --- a/config/profile.sh.in +++ b/config/profile.sh.in @@ -1,4 +1,17 @@ -if [ -n "@DEBUGINFOD_URLS@" ]; then - DEBUGINFOD_URLS="${DEBUGINFOD_URLS-}${DEBUGINFOD_URLS:+ }@DEBUGINFOD_URLS@" - export DEBUGINFOD_URLS + +# $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. +# See also [man debuginfod-client-config] for other environment variables +# such as $DEBUGINFOD_MAXSIZE, $DEBUGINFOD_MAXTIME, $DEBUGINFOD_PROGRESS. + +if [ -z "$DEBUGINFOD_URLS" ]; then + prefix="@prefix@" + debuginfod_urls=`find "@sysconfdir@/debuginfod/" -name '*.urls' | xargs cat | tr '\n' ' '` + if [ -n "$debuginfod_urls" ]; then + DEBUGINFOD_URLS="$debuginfod_urls" + export DEBUGINFOD_URLS + fi + unset debuginfod_urls + unset prefix fi