Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap tools should quote all full pathnames #6

Open
sshambar opened this issue Aug 16, 2016 · 1 comment
Open

bootstrap tools should quote all full pathnames #6

sshambar opened this issue Aug 16, 2016 · 1 comment

Comments

@sshambar
Copy link

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
Copy link
Author

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 :)

praiskup added a commit to praiskup/bootstrap that referenced this issue Oct 21, 2016
Add new syntax for source inline:

  # set '$inline_source_dir' to `dirname "$0"/`
  inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`
  . "$inline_source_dir"/sourced-file

This version avoids "`"sth"`" like commands (nested quotes), while
we are now able to use inline-source script within directory
which pathname contains spaces.  As a side effect, we save some
fork() calls because the directory is constructed only once.

Related to github issue gnulib-modules#6.

* build-aux/inline-source: Move ourself to the new syntax,
document new syntax.
(func_include): Parse the new syntax, quote $progpath properly.
* build-aux/bootstrap.in: Use new syntax.
* bootstrap: Sync with new sources.
praiskup added a commit to praiskup/bootstrap that referenced this issue Oct 21, 2016
Add new syntax for source inline:

  # set '$inline_source_dir' to `dirname "$0"/`
  inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`
  . "$inline_source_dir"/sourced-file

This version avoids "`"sth"`" like commands (nested quotes), while
we are now able to use inline-source script within directory
which pathname contains spaces.  As a side effect, we save some
fork() calls because the directory is constructed only once.

Related to github issue gnulib-modules#6.

* build-aux/inline-source: Move ourself to the new syntax,
document new syntax.
(func_include): Parse the new syntax, quote $progpath properly.
* build-aux/bootstrap.in: Use new syntax.
* bootstrap: Sync with new sources.
praiskup added a commit to praiskup/bootstrap that referenced this issue Oct 21, 2016
Add new syntax for source inline:

  # set '$inline_source_dir' to `dirname "$0"/`
  inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`
  . "$inline_source_dir"/sourced-file

This version avoids "`"sth"`" like commands (nested quotes), while
we are now able to use inline-source script within directory
which pathname contains spaces.  As a side effect, we save some
fork() calls because the directory is constructed only once.

Related to github issue gnulib-modules#6.

* build-aux/inline-source: Move ourself to the new syntax,
document new syntax.
(func_include): Parse the new syntax, quote $progpath properly.
* build-aux/bootstrap.in: Use new syntax.
* bootstrap: Sync with new sources.
praiskup added a commit to praiskup/bootstrap that referenced this issue Oct 21, 2016
Add new syntax for source inline:

  # set '$inline_source_dir' to `dirname "$0"/`
  inline_source_dir=`echo "$0" |${SED-sed} 's|[^/]*$||'`
  . "$inline_source_dir"/sourced-file

This version avoids "`"sth"`" like commands (nested quotes), while
we are now able to use inline-source script within directory
which pathname contains spaces.  As a side effect, we save some
fork() calls because the directory is constructed only once.

Related to github issue gnulib-modules#6.

* build-aux/inline-source: Move ourself to the new syntax,
document new syntax.
(func_include): Parse the new syntax, quote $progpath properly.
* build-aux/bootstrap.in: Use new syntax.
* bootstrap: Sync with new sources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant