diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2015-11-01 21:43:31 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2015-11-04 06:47:52 +0100 |
commit | dc8bd92d5faae8b587f525f54929cf9d9fae9eee (patch) | |
tree | 32085b17b5c3a90c4795b1659b94a66abf5153a7 /bootstrap | |
parent | a3c6e99c9cde0f786fa3df88360c84cf33ddc278 (diff) | |
download | libtool-dc8bd92d5faae8b587f525f54929cf9d9fae9eee.tar.gz |
gl/funclib.sh: func_quotefast_eval & tilde fix
Testsuite detected that printf built-in in Bash up to 4.2 was not
able to properly escape tilde.
* gl/build-aux/funclib.sh (func_quote_for_eval): If printf
supports -v option, test also whether we properly escape tilde.
With Bash <= 4.2, call func_quote_portable with ~* strings.
* bootstrap: Sync with funclib.sh.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -230,7 +230,7 @@ vc_ignore= # Source required external libraries: # Set a version string for this script. -scriptversion=2015-10-12.13; # UTC +scriptversion=2015-11-01.21; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 @@ -1337,10 +1337,27 @@ func_quote_portable () # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', # but optimized for speed. Result is stored in $func_quotefast_eval. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then - func_quotefast_eval () - { - printf -v func_quotefast_eval_result %q "$1" - } + printf -v _GL_test_printf_tilde %q '~' + if test '\~' = "$_GL_test_printf_tilde"; then + func_quotefast_eval () + { + printf -v func_quotefast_eval_result %q "$1" + } + else + # Broken older Bash implementations. Make those faster too if possible. + func_quotefast_eval () + { + case $1 in + '~'*) + func_quote_portable false "$1" + func_quotefast_eval_result=$func_quote_portable_result + ;; + *) + printf -v func_quotefast_eval_result %q "$1" + ;; + esac + } + fi else func_quotefast_eval () { |