libgcc: Quote variable in Makefile.in

Message ID 20221012115252.1881060-1-jwakely@redhat.com
State Accepted, archived
Headers
Series libgcc: Quote variable in Makefile.in |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jonathan Wakely Oct. 12, 2022, 11:52 a.m. UTC
  This isn't very important as the error is harmless, but it's easy to fix
and so is one less thing that might confuse people when looking at build
logs.

OK for trunk?

-- >8 --

If the xgcc executable has not been built (or has been removed by 'make
clean') then the command to print the multilib dir fails, and so the
MULTIOSDIR variable is empty. That then causes:
/bin/sh: line 0: test: !=: unary operator expected

We can avoid it by quoting the variable.

libgcc/ChangeLog:

	* Makefile.in: Quote variable.
---
 libgcc/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law Oct. 12, 2022, 4:33 p.m. UTC | #1
On 10/12/22 05:52, Jonathan Wakely via Gcc-patches wrote:
> This isn't very important as the error is harmless, but it's easy to fix
> and so is one less thing that might confuse people when looking at build
> logs.
>
> OK for trunk?
>
> -- >8 --
>
> If the xgcc executable has not been built (or has been removed by 'make
> clean') then the command to print the multilib dir fails, and so the
> MULTIOSDIR variable is empty. That then causes:
> /bin/sh: line 0: test: !=: unary operator expected
>
> We can avoid it by quoting the variable.
>
> libgcc/ChangeLog:
>
> 	* Makefile.in: Quote variable.

OK

jeff
  

Patch

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 1fe708a93f7..6e2a0470944 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -310,7 +310,7 @@  CRTSTUFF_T_CFLAGS =
 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
 
-MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
+MULTIOSSUBDIR := $(shell if test "$(MULTIOSDIR)" != .; then echo /$(MULTIOSDIR); fi)
 inst_libdir = $(libsubdir)$(MULTISUBDIR)
 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)