[PATCH] Support nullglob in profile.*.in files

2022-08-16 Thread Martin Liška
In openSUSE we have the following RPM checker that uses
shopt -s nullglob:
https://github.com/openSUSE/post-build-checks/blob/master/checks/50-check-libtool-deps#L31

The script loads all /etc/profile.d/*.sh files via source $FILE which
can end up by stuck cat (with no arguments):

shopt -s nullglob ; cat "/etc/debuginfod"/*.urls
(stuck)
---
 config/profile.csh.in | 2 +-
 config/profile.sh.in  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config/profile.csh.in b/config/profile.csh.in
index 74c20c99..d962d969 100644
--- a/config/profile.csh.in
+++ b/config/profile.csh.in
@@ -6,7 +6,7 @@
 
 if (! $?DEBUGINFOD_URLS) then
 set prefix="@prefix@"
-set DEBUGINFOD_URLS=`sh -c 'cat "$0"/*.urls 2>/dev/null; :' 
"@sysconfdir@/debuginfod" | tr '\n' ' '`
+set DEBUGINFOD_URLS=`sh -c 'cat /dev/null "$0"/*.urls 2>/dev/null; :' 
"@sysconfdir@/debuginfod" | tr '\n' ' '`
 if ( "$DEBUGINFOD_URLS" != "" ) then
 setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS"
 else
diff --git a/config/profile.sh.in b/config/profile.sh.in
index bad20b1e..3f4397dc 100644
--- a/config/profile.sh.in
+++ b/config/profile.sh.in
@@ -6,7 +6,7 @@
 
 if [ -z "$DEBUGINFOD_URLS" ]; then
 prefix="@prefix@"
-DEBUGINFOD_URLS=$(cat "@sysconfdir@/debuginfod"/*.urls 2>/dev/null | tr 
'\n' ' ')
+DEBUGINFOD_URLS=$(cat /dev/null "@sysconfdir@/debuginfod"/*.urls 
2>/dev/null | tr '\n' ' ')
 [ -n "$DEBUGINFOD_URLS" ] && export DEBUGINFOD_URLS || unset 
DEBUGINFOD_URLS
 unset prefix
 fi
-- 
2.37.1



Re: [PATCH] Support nullglob in profile.*.in files

2022-08-16 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> In openSUSE we have the following RPM checker that uses
> shopt -s nullglob:
> https://github.com/openSUSE/post-build-checks/blob/master/checks/50-check-libtool-deps#L31

OK, lgtm.

We'd hate to have a stuck cat.

- FChE


[Bug tools/29498] New: Is it expected that eu-strip strips .note.GNU-stack

2022-08-16 Thread jpalus at fastmail dot com via Elfutils-devel
https://sourceware.org/bugzilla/show_bug.cgi?id=29498

Bug ID: 29498
   Summary: Is it expected that eu-strip strips .note.GNU-stack
   Product: elfutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: tools
  Assignee: unassigned at sourceware dot org
  Reporter: jpalus at fastmail dot com
CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Accidentally we've started to strip crt*.o files produced by glibc and were
surprised by the fact that eu-strip gets rid of .note.GNU-stack section
resulting in incorrect linking.

$ gcc -c test.c -o test.o
$ readelf -S test.o|grep GNU-stack
  [ 5] .note.GNU-stack   PROGBITS   0074
$ eu-strip test.o
$ readelf -S test.o|grep GNU-stack
(empty)

I see following comment in strip.c:

> - special sections named ".comment" and ".note" are kept


https://sourceware.org/git/?p=elfutils.git;a=blob;f=src/strip.c;h=452b12796dd3b7ff3a46d13a2bfb9aa0f5c93ac9;hb=HEAD#l1361

The question is whether observed behavior is expected or rather .note.GNU-stack
should be kept?

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