public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/26906] New: Incompatible use of foldername character @ with SED in libc/libelf
@ 2020-11-16 15:20 jaapvstr at gmail dot com
  0 siblings, 0 replies; only message in thread
From: jaapvstr at gmail dot com @ 2020-11-16 15:20 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=26906

            Bug ID: 26906
           Summary: Incompatible use of foldername character @ with SED in
                    libc/libelf
           Product: glibc
           Version: 2.34
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: jaapvstr at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

This bug applies to at least GLIBC 2.19 (haven't checked further back) onwards
to 2.34 and concerns code in:
https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/Makefile#l532

While trying to build GCC-4.9.4 with glibc 2.19, it crashed on gcc pass 2 due
to unsafe use of SED. The root cause is an incompatibility with a directory I
used. It had a-@ sign in the path which was also used in the sed:

4-asustor-linux-gnu/build/build-libc-final/multilib/stamp.os
/volume2/owncloud/data/xxxxxxxx@gmail.com/files/xxxx/crosstool-ng/bin/.build/x86_64-asustor-linux-gnu/build/build-libc-final/multilib//stamp.os
| LC_ALL=C sed
's@^/volume2/owncloud/data/xxxxxxxxx@gmail.com/files/Apkg/crosstool-ng/bin/.build/x86_64-asustor-linux-gnu/build/build-libc-final/multilib/([^/])/stamp.os$@rtld-1'"
+=$file@";; /.a) echo rtld-${lib%%/*} += $file ;; *) echo "Wasn't expecting
$lib($file)" >&2; exit 1 ;; esac; done >
/volume2/owncloud/data/xxxxxxxx@gmail.com/files/xxxx/crosstool-ng/bin/.build/x86_64-asustor-linux-gnu/build/build-libc-final/
multilib/elf/librtld.mkT
[ALL ] sed: -e expression #1, char 168: unknown option to `s'

While the workaround is pretty straightforward (just use a folder without @),
it would be nice to have this issue solved by making the code @-character-safe.

Please find below some sample code that could possibly be adapted for this
purpose:
pattern1='PATTERN TO MATCH'
safe_pattern1=$(printf '%s\n' "$pattern1" | sed 's/[[.^$/]/\&/g')
pattern2="PATTERN TO REPLACE"
safe_pattern2=$(printf '%s\n' "$pattern2" | sed 's/[[.^$/]/\&/g')
sed -i "s/${safe_pattern1}/${safe_pattern2}" /the/file/to/patch

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-16 15:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 15:20 [Bug libc/26906] New: Incompatible use of foldername character @ with SED in libc/libelf jaapvstr at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).