public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Escape sed delimiter in Makefile [BZ #25127]
@ 2023-08-23 16:51 Shane Slattery
  2023-08-23 19:40 ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Shane Slattery @ 2023-08-23 16:51 UTC (permalink / raw)
  To: libc-alpha; +Cc: Shane Slattery, carlos

This patch proposes a fix for BZ report #25127.
Like mentioned in BZ #25127, the use of an @ character in glibc's
    build path breaks two sed commands, as @ is the delimiter used.
    This subsequently makes the build fail, as the path
    is then considered part of the regex.

This commonly ends up affecting Jenkins concurrent builds, due to
    it's default usage of @ in the workspace path for said builds.

While a patch was suggested in the original BZ report, this is only
    a mitigation and doesn't fix the issue, i.e. the same issue would
    occur with the character #.

The issue is fixed by adding an additional sed command to escape
    possible @'s in the path before it is used with sed later.

No regressions or further issues have been observed due to this change.
---
 elf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/elf/Makefile b/elf/Makefile
index c00e2ccfc5..3545ad6d3c 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1291,8 +1291,9 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
 
 # For lld, skip preceding addresses and values before matching the archive and the member.
 $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
+	$(eval common_objpfx_esc = $(shell echo '${common-objpfx}' | sed -n 's@\@@\\\@@gp'))
 	LC_ALL=C \
-	sed -n 's@^[0-9a-f ]*$(common-objpfx)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
+	sed -n 's@^[0-9a-f ]*$(common_objpfx_esc)\([^(]*\)(\([^)]*\.os\)) *.*$$@\1 \2@p' \
 	    $< | \
 	while read lib file; do \
 	  case $$lib in \
@@ -1300,7 +1301,7 @@ $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
 	    LC_ALL=C grep -F -l /$$file \
 		  $(common-objpfx)stamp.os $(common-objpfx)*/stamp.os | \
 	    LC_ALL=C \
-	    sed 's@^$(common-objpfx)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
+	    sed 's@^$(common_objpfx_esc)\([^/]*\)/stamp\.os$$@rtld-\1'" +=$$file@"\
 	    ;; \
 	  */*.a) \
 	    echo rtld-$${lib%%/*} += $$file ;; \
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] elf: Escape sed delimiter in Makefile [BZ #25127]
  2023-08-23 16:51 [PATCH] elf: Escape sed delimiter in Makefile [BZ #25127] Shane Slattery
@ 2023-08-23 19:40 ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2023-08-23 19:40 UTC (permalink / raw)
  To: Shane Slattery; +Cc: libc-alpha, carlos

On Aug 23 2023, Shane Slattery wrote:

> diff --git a/elf/Makefile b/elf/Makefile
> index c00e2ccfc5..3545ad6d3c 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -1291,8 +1291,9 @@ $(objpfx)librtld.map: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
>  
>  # For lld, skip preceding addresses and values before matching the archive and the member.
>  $(objpfx)librtld.mk: $(objpfx)librtld.map Makefile
> +	$(eval common_objpfx_esc = $(shell echo '${common-objpfx}' | sed -n 's@\@@\\\@@gp'))

There is no need to shell out as you can just use $(subst).

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-23 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 16:51 [PATCH] elf: Escape sed delimiter in Makefile [BZ #25127] Shane Slattery
2023-08-23 19:40 ` Andreas Schwab

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).