[PATCH v2] config: simplify profile.*sh.in

2022-01-19 Thread наб via Elfutils-devel
Hi!

On Tue, Jan 18, 2022 at 11:13:28AM -0500, Frank Ch. Eigler wrote:
> You mean "prefix=@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 (=> 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,
наб

-- >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ńska 
---
 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 @@
 
 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
-- 
2.34.1


signature.asc
Description: PGP signature


[Bug debuginfod/27673] [debuginfod] Handle source requests for same buildid more efficiently

2022-01-19 Thread fche at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=27673

Frank Ch. Eigler  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #7 from Frank Ch. Eigler  ---
For now, shelving this idea until a clearer need arises.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

[Bug debuginfod/28284] support description functionality through HEAD

2022-01-19 Thread fche at redhat dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=28284

--- Comment #3 from Frank Ch. Eigler  ---
The problem of federation reminded me that we haven't solved this problem yet.

> int debuginfod_info_debuginfo (debuginfod_client *client,
>const unsigned char *build_id,
>int build_id_len,
>size_t *size, size_t *transfer_size);

It'd also need the other current X-DEBUGINFOD-* response headers, -FILE: and
-ARCHIVE:.  And we'd need two other functions for source and executable.  And
if any fields get added at the server by our software (or someone else's
proxy!), the API would have to expand to match.

For federation purposes, we'd need to forward all these headers from upstream
to downstream.  And we'd like to get this data for an active transfer, not
really a historical one (don't want to have to save/cache), and not make an
extra query to a debuginfod server just to fetch this.

These considerations lead me back to suggesting an API oriented toward fetching
the headers of the current/last fetch made with a debuginfod_client, just like
the debuginfod_get_url(), returning some subset of what's currently stored by
the client code as ->winning_headers.  Specifically, I'd say save & return
those response headers with prefix "x-debuginfod-".

These ones would be the same ones that a hypothetical "debuginfod-find -d"
(describe?) option would want to print to stderr: a more concentrated output
than the -v (verbose) firehose we were talking about earlier.

-- 
You are receiving this mail because:
You are on the CC list for the bug.