public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix build when source directory includes @ character
@ 2020-10-31 14:36 FX
  2020-11-02 10:12 ` Richard Sandiford
  0 siblings, 1 reply; 7+ messages in thread
From: FX @ 2020-10-31 14:36 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

Hi,

Attached is a fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57076
Currently, we cannot build GCC when the source directory contains a @ character (which is a problem for Homebrew, where we typically build in directories such as /tmp/gcc@10/src: https://github.com/Homebrew/brew/pull/9007)
The problem is because gcc-vers.texi then contain an unquoted @ character, which is interpreted as a texinfo command.
The patch fixes the rule in gcc/Makefile.in so that stray @ characters are quoted as @@

Tested and bootstrapped on x86_64-apple-darwin19

PS: It’s possible the same issue occurs with characters { and } in the path (according to https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Conventions.html). Do you think they should be quoted too?

Cheers,
FX


[-- Attachment #2: at.diff --]
[-- Type: application/octet-stream, Size: 526 bytes --]

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7b94497b6f2..f2f6452c591 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3286,7 +3286,7 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
 	 then echo "@set DEVELOPMENT"; \
 	 else echo "@clear DEVELOPMENT"; \
 	 fi) > $@T
-	$(build_file_translate) echo @set srcdir $(abs_srcdir) >> $@T
+	$(build_file_translate) echo @set srcdir `echo $(abs_srcdir) | sed -e 's|@|@@|g'` >> $@T
 	if [ -n "$(PKGVERSION)" ]; then \
 	  echo "@set VERSION_PACKAGE $(PKGVERSION)" >> $@T; \
 	fi

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

* Re: [patch] Fix build when source directory includes @ character
  2020-10-31 14:36 [patch] Fix build when source directory includes @ character FX
@ 2020-11-02 10:12 ` Richard Sandiford
  2020-11-02 10:40   ` FX
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Sandiford @ 2020-11-02 10:12 UTC (permalink / raw)
  To: FX via Gcc-patches; +Cc: FX

FX via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi,
>
> Attached is a fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57076
> Currently, we cannot build GCC when the source directory contains a @ character (which is a problem for Homebrew, where we typically build in directories such as /tmp/gcc@10/src: https://github.com/Homebrew/brew/pull/9007)
> The problem is because gcc-vers.texi then contain an unquoted @ character, which is interpreted as a texinfo command.
> The patch fixes the rule in gcc/Makefile.in so that stray @ characters are quoted as @@
>
> Tested and bootstrapped on x86_64-apple-darwin19
>
> PS: It’s possible the same issue occurs with characters { and } in the path (according to https://www.gnu.org/software/texinfo/manual/texinfo/html_node/Conventions.html). Do you think they should be quoted too?

Yeah, seems like a good idea to fix those too.  (I checked locally
that the build does fail for a build directory called “{foo}”.)

Patch looks good otherwise though.

Thanks,
Richard

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

* Re: [patch] Fix build when source directory includes @ character
  2020-11-02 10:12 ` Richard Sandiford
@ 2020-11-02 10:40   ` FX
  2020-11-02 15:10     ` Richard Sandiford
  2020-11-17  0:25     ` Jeff Law
  0 siblings, 2 replies; 7+ messages in thread
From: FX @ 2020-11-02 10:40 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: FX via Gcc-patches

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

Here is an updated patch, that quotes all three makeinfo special characters: @ { }
Tested on a build with source directory /tmp/foo@bar{gee}qux

OK to commit?


[-- Attachment #2: at.diff --]
[-- Type: application/octet-stream, Size: 538 bytes --]

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7b94497b6f2..978a08f7b04 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3286,7 +3286,7 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
 	 then echo "@set DEVELOPMENT"; \
 	 else echo "@clear DEVELOPMENT"; \
 	 fi) > $@T
-	$(build_file_translate) echo @set srcdir $(abs_srcdir) >> $@T
+	$(build_file_translate) echo @set srcdir `echo $(abs_srcdir) | sed -e 's|\\([@{}]\\)|@\\1|g'` >> $@T
 	if [ -n "$(PKGVERSION)" ]; then \
 	  echo "@set VERSION_PACKAGE $(PKGVERSION)" >> $@T; \
 	fi

[-- Attachment #3: at.ChangeLog --]
[-- Type: application/octet-stream, Size: 87 bytes --]

gcc/ChangeLog:

	PR bootstrap/57076
	* Makefile.in (gcc-vers.texi): Quote @, { and }.


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

* Re: [patch] Fix build when source directory includes @ character
  2020-11-02 10:40   ` FX
@ 2020-11-02 15:10     ` Richard Sandiford
  2020-11-17  0:25     ` Jeff Law
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Sandiford @ 2020-11-02 15:10 UTC (permalink / raw)
  To: FX via Gcc-patches; +Cc: FX

FX via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Here is an updated patch, that quotes all three makeinfo special characters: @ { }
> Tested on a build with source directory /tmp/foo@bar{gee}qux
>
> OK to commit?
>
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 7b94497b6f2..978a08f7b04 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -3286,7 +3286,7 @@ gcc-vers.texi: $(BASEVER) $(DEVPHASE)
>  	 then echo "@set DEVELOPMENT"; \
>  	 else echo "@clear DEVELOPMENT"; \
>  	 fi) > $@T
> -	$(build_file_translate) echo @set srcdir $(abs_srcdir) >> $@T
> +	$(build_file_translate) echo @set srcdir `echo $(abs_srcdir) | sed -e 's|\\([@{}]\\)|@\\1|g'` >> $@T
>  	if [ -n "$(PKGVERSION)" ]; then \
>  	  echo "@set VERSION_PACKAGE $(PKGVERSION)" >> $@T; \
>  	fi

OK, thanks.  I guess:

  sed 's|[@{}]|@&|g'

would work too, but I don't know which is more portable.

Richard

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

* Re: [patch] Fix build when source directory includes @ character
  2020-11-02 10:40   ` FX
  2020-11-02 15:10     ` Richard Sandiford
@ 2020-11-17  0:25     ` Jeff Law
  2020-11-17  8:22       ` FX
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Law @ 2020-11-17  0:25 UTC (permalink / raw)
  To: FX, Richard Sandiford; +Cc: FX via Gcc-patches


On 11/2/20 3:40 AM, FX via Gcc-patches wrote:
> Here is an updated patch, that quotes all three makeinfo special characters: @ { }
> Tested on a build with source directory /tmp/foo@bar{gee}qux
>
> OK to commit?

OK.  You have commit privs, right?


jeff



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

* Re: [patch] Fix build when source directory includes @ character
  2020-11-17  0:25     ` Jeff Law
@ 2020-11-17  8:22       ` FX
  2020-11-17 16:22         ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: FX @ 2020-11-17  8:22 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Sandiford, FX via Gcc-patches

> OK.  You have commit privs, right?

Yes, and I did commit after Richard’s OK: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=034db20e2ea8301b5dc251bf10a97ce1cf90655f

… but I forgot to send an email saying I had, sorry.

FX

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

* Re: [patch] Fix build when source directory includes @ character
  2020-11-17  8:22       ` FX
@ 2020-11-17 16:22         ` Jeff Law
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Law @ 2020-11-17 16:22 UTC (permalink / raw)
  To: FX; +Cc: Richard Sandiford, FX via Gcc-patches



On 11/17/20 1:22 AM, FX wrote:
>> OK.  You have commit privs, right?
> Yes, and I did commit after Richard’s OK: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=034db20e2ea8301b5dc251bf10a97ce1cf90655f
>
> … but I forgot to send an email saying I had, sorry.
No worries.  Thanks.
jeff


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

end of thread, other threads:[~2020-11-17 16:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 14:36 [patch] Fix build when source directory includes @ character FX
2020-11-02 10:12 ` Richard Sandiford
2020-11-02 10:40   ` FX
2020-11-02 15:10     ` Richard Sandiford
2020-11-17  0:25     ` Jeff Law
2020-11-17  8:22       ` FX
2020-11-17 16:22         ` Jeff Law

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