gnulib-modules / bootstrap

a clean rewrite of gnulib bootstrap for scriptable extensibility and proper error reporting
Other
8 stars 6 forks source link

bootstrap tools should quote all full pathnames #6

Open sshambar opened 8 years ago

sshambar commented 8 years ago

I have several machines (which I don't admin :) where the development directory is a child of a "contains space" path (ugh, I know...). I figured, at least the "bootstrap" phase should handle this case :)

I tracked down all uses of full paths in bootstrap (I think), and updates all references/tests to correctly quote them. I tested in various "challenging" directories, and the patch I have appears to fix bootstrap to work as expected.

I'll submit a pull request.

Thanks, Scott

sshambar commented 8 years ago

On 2016-08-17 14:38, Pavel Raiskup wrote: In tests/test-option-parser.sh:

  • output=$helper ${1+"$@"} 2>/dev/null
  • output=$__GL_ALL_SHELLS_SHELL "$helper" ${1+"$@"} 2>/dev/null Thanks for your work!

Maybe it is detail, but could we have rather $helper properly quoted and later eval()ed to not copy the ugly $__GL_ALL_SHELLS_SHELL on multiple places?

Not sure if my email reply got back to you or not, so I'll repost my responses here :) --- reply As I suspected, the eval solution breaks several tests as it swallows empty parameters passed via ${1+"@"}. Here's the closest I could come up with:

func_quote_arg eval "$abs_srcdir" _G_qabs_srcdir=$func_quote_arg_result helper="$__GL_ALL_SHELLS_SHELL $_G_qabs_srcdir/test-option-parser-helper"

output=eval $helper ${1+"$@"} 2>/dev/null

Tests similar to <-t ''> broke with this solution... if you see another method to handle the word splitting in the shell argument, I'd willing to it (I don't think we want to redefine IFS here...)

Another solution is to define a quick shell var, eg:

hshell=$__GL_ALL_SHELLS_SHELL

output=$hshell "$helper" ${1+"$@"} 2>/dev/null

... which is pretty clean looking :)