Skip to contentSkip to conversation

core: detect and reject build paths which contain an '@'

PATCH New Yann E. MORIN 2 participants 3 messages Aug 20, 2018 – Oct 24, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 core: detect and reject build paths which contain an '@'

gcc does not build when the srcdir path contains a '@', because that path is then substitued in a texi file as argument to an @include directive. But then, the '@' in the path will start a command evaluation of its own, thus breaking the build. For example, with a $(O) path set to /home/ymorin/dev/buildroot/O/to at ti :

    perl ../../gcc/../contrib/texi2pod.pl ../../gcc/doc/invoke.texi > gcc.pod
    ../../gcc/doc/invoke.texi:1678: unknown command `ti'
    ../../gcc/doc/invoke.texi:1678: @include: could not find /home/ymorin/dev/buildroot/O/to/build/host-gcc-initial-7.3.0/build/gcc/../../gcc/../libiberty/at-file.texi
Reported-by c32 on IRC
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Makefile +5 -0
index d1ee9293a2..8a2b614b81 100644
@@ -60,6 +60,11 @@ override O := $(patsubst %/,%,$(patsubst %.,%,$(O)))
 # avoid empty CANONICAL_O in case on non-existing entry.
 CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))
 
+# gcc fails to build when the srcdir contains a '@'
+ifneq ($(CANONICAL_O),$(subst @,,$(CANONICAL_O)))
+$(error The build directory can not contain a '@')
+endif
+
 CANONICAL_CURDIR = $(realpath $(CURDIR))
 
 REQ_UMASK = 0022
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 core: detect and reject build paths which contain an '@'

Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

gcc does not build when the srcdir path contains a '@', because that path is then substitued in a texi file as argument to an @include directive. But then, the '@' in the path will start a command evaluation of its own, thus breaking the build. For example, with a $(O) path set to /home/ymorin/dev/buildroot/O/to at ti :

    perl ../../gcc/../contrib/texi2pod.pl ../../gcc/doc/invoke.texi > gcc.pod
    ../../gcc/doc/invoke.texi:1678: unknown command `ti'
    ../../gcc/doc/invoke.texi:1678: @include: could not find /home/ymorin/dev/buildroot/O/to/build/host-gcc-initial-7.3.0/build/gcc/../../gcc/../libiberty/at-file.texi
Reported-by c32 on IRC
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Makefile +0 -0
index d1ee9293a2..8a2b614b81 100644

Makefile override O := $(patsubst %/,%,$(patsubst %.,%,$(O))) · line 64

Quoted 5 lines
Makefile +2 -0
@@ -60,6 +60,11 @@ override O := $(patsubst %/,%,$(patsubst %.,%,$(O)))
 # avoid empty CANONICAL_O in case on non-existing entry.
 CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))
 
+# gcc fails to build when the srcdir contains a '@'
+ifneq ($(CANONICAL_O),$(subst @,,$(CANONICAL_O)))

I find findstring easier to read, so I've changed it to:

ifneq ($(findstring @,$(CANONICAL_O)),)

And committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 core: detect and reject build paths which contain an '@'

Quoted 27 lines
Quoted 26 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

"Peter" == Peter Korsgaard <[email protected]> writes:

"Yann" == Yann E MORIN <[email protected]> writes:

gcc does not build when the srcdir path contains a '@', because that path is then substitued in a texi file as argument to an @include directive. But then, the '@' in the path will start a command evaluation of its own, thus breaking the build. For example, with a $(O) path set to /home/ymorin/dev/buildroot/O/to at ti :

perl ../../gcc/../contrib/texi2pod.pl ../../gcc/doc/invoke.texi > gcc.pod
../../gcc/doc/invoke.texi:1678: unknown command `ti'
../../gcc/doc/invoke.texi:1678: @include: could not find /home/ymorin/dev/buildroot/O/to/build/host-gcc-initial-7.3.0/build/gcc/../../gcc/../libiberty/at-file.texi

Reported-by c32 on IRC

---
Makefile | 5 +++++

1 file changed, 5 insertions(+)
Makefile +0 -0
index d1ee9293a2..8a2b614b81 100644
@@ -60,6 +60,11 @@ override O := $(patsubst %/,%,$(patsubst %.,%,$(O)))
 # avoid empty CANONICAL_O in case on non-existing entry.
 CANONICAL_O := $(shell mkdir -p $(O) >/dev/null 2>&1)$(realpath $(O))
Quoted 8 lines

Makefile override O := $(patsubst %/,%,$(patsubst %.,%,$(O))) · line 64

Quoted 2 lines
Makefile +2 -0
+# gcc fails to build when the srcdir contains a '@'
+ifneq ($(CANONICAL_O),$(subst @,,$(CANONICAL_O)))

I find findstring easier to read, so I've changed it to:

ifneq ($(findstring @,$(CANONICAL_O)),)

And committed, thanks.

Committed to 2018.02.x and 2018.08.x with that change, thanks.

Signature · 1 line
Bye, Peter Korsgaard