From: Ralf Wildenhues Date: Tue, 28 Dec 2004 12:40:43 +0000 (+0000) Subject: * config/general.m4sh: New variable quote_scanset.. X-Git-Tag: release-2-1b~804 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38dc34aca8bdc392e56df8e8085e4827f3025392;p=thirdparty%2Flibtool.git * config/general.m4sh: New variable quote_scanset.. (func_quote_for_eval, func_quote_for_expand) ..use it to work around SunOS ksh `case' backslash-escaping bug: protect character class by variable expansion. Reported by Alexander Kurz . --- diff --git a/ChangeLog b/ChangeLog index 22aed0ed4..845851bf6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-12-28 Ralf Wildenhues + * config/general.m4sh: New variable quote_scanset.. + (func_quote_for_eval, func_quote_for_expand) ..use it to work around + SunOS ksh `case' backslash-escaping bug: protect character class by + variable expansion. Reported by Alexander Kurz . + * tests/quote.test: Restart under the correct shell (the one $ECHO was computed for). diff --git a/config/general.m4sh b/config/general.m4sh index 3088d9594..cc4777423 100644 --- a/config/general.m4sh +++ b/config/general.m4sh @@ -95,6 +95,9 @@ sed_quote_subst='s/\([[`"$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' +# Protect character class for func_quote_* by variable expansion. +quote_scanset='[[@<:@~#^*{};<>?'"'"' ]]' + # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. @@ -282,9 +285,11 @@ func_quote_for_eval () # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"") + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *$quote_scanset* | *@:>@* | *\|* | *\&* | *\(* | *\)* | "") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) @@ -305,8 +310,11 @@ func_quote_for_expand () # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[[\@<:@\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]]*|*@:>@*|"") + # in scan sets, and some SunOS ksh mistreat backslash-escaping + # in scan sets (worked around with variable expansion), + # and furthermore cannot handle '|' '&' '(' ')' in scan sets + # at all, so we specify them separately. + *$quote_scanset* | *@:>@* | *\|* | *\&* | *\(* | *\)* | "") my_arg="\"$my_arg\"" ;; esac