bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: embedded newlines in shell function variable expansion


From: Byrnes, Robert
Subject: RE: embedded newlines in shell function variable expansion
Date: Fri, 9 Oct 2020 19:35:00 +0000

> Hm, interesting.  I guess it's possible we are stripping out newlines before 
> invoking the shell.  I don't remember that being the case but it could be.
>
> I'm not exactly sure what your objective is ...

We use a make variable that can be set to a whitespace-separated list of 
pathnames.  These are passed to functions like $(notdir ...), and that broke 
when a script happened to use newlines instead of spaces as separators, because 
all of the pathnames were glued together into a single word when the newlines 
were stripped.  We don't actually care about preserving newlines, and would be 
happy if they turned into spaces.  But we do care about preserving whitespace 
that separates words.

> ... but note that as written this probably won't do what you want, because if 
> you run:
>
> /bin/sh -c 'echo foo
> bar'
>
> then it will echo "foo" and try to run the program "bar".

I guess that particular case could be protected by quotes as $(shell 
"$(ENTRIES)").

--
Bob

reply via email to

[Prev in Thread] Current Thread [Next in Thread]