Summary: Better support for escaping of function parameters
Submitted by: elfring
Submitted on: Fri 23 Jun 2017 12:11:01 PM CEST
Severity: 3 - Normal
Item Group: Enhancement
Assigned to: None
Discussion Lock: Any
Component Version: 4.2.1
Operating System: Any
Fixed Release: None
Triage Status: None
I am also especially interested in the clarification under which circumstances
a passed text should be treated as a single argument (or it will be processed
as separate parameters as usual according to the syntax). The functionality
“word splitting” can occasionally trigger special software development
I see a need to support safer data processing there.
* Escape a string by a corresponding function call so that it is reusable as a
* Provide another function call which can perform the opposite transformation
so that a value is split into smaller items.
How do you think about to add extra support for such data conversion in the
make function library?
It's important to understand that in GNU make (unlike the shell, for example)
splitting of arguments in function invocations is done _before_ the arguments
So, you don't have to worry about special characters embedded in variables
making a hash of your expansion. If they're not present directly in the call,
they're not special.
So for example, this works fine:
foo = abcd, 234, (fo"o), bar'))
show = 1: |$1|
$(info $(call show,$(foo)))
1: |abcd, 234, (fo"o), bar'))|
This is true of all make functions that take arguments. As a result there's
very little reason to need something that will escape a string, to keep it
from being interpreted by make functions.
It is useful to be able to escape whitespace and some other characters, in
some contexts (but this is NOT needed to delimit arguments to make functions).
But that's bug #712 as already noted, so we don't need another bug for this.