options-parser: correctly quote shell meta-characters in arguments.
commit4930ebf6b1a7976c4c7a42f2d99e5176e1cbbd94
authorGary V. Vaughan <gary@gnu.org>
Wed, 10 Oct 2012 17:09:48 +0000 (11 00:09 +0700)
committerGary V. Vaughan <gary@gnu.org>
Fri, 12 Oct 2012 13:18:28 +0000 (12 20:18 +0700)
tree722598c6b692561641379d28688d1b347b3b7562
parenta73a99b88a93e2880a6ecbfbb76a248be10aa933
options-parser: correctly quote shell meta-characters in arguments.

When any argument contains a shell meta-character, it needs to be
quoted when passed around.  We already pass parameter lists as
space delimited strings of arguments, and pass the string through
eval to turn it back into a list before re-assigning using `set'.
To prevent the shell from interpreting any meta-characters during
an `eval set dummy $argumentlist', they must be quoted again
inside the quoted argument list.
* build-aux/funclib.sh (func_quote_for_eval): Be careful to keep
a separate tally of quoted and unquoted argument lists, to
conform to the API of the single argument func_quote_for_eval
implementation in build-aux/general.m4sh.
* bulid-aux/options-parser (func_run_hooks): To account for the
doubly quoted meta-character argument lists, we must eval the
parameter reassignment `set' call separately from evaluating the
dynamically named hook results variable.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
build-aux/funclib.sh
build-aux/options-parser