No description provided.
By analyzing the blame information on this pull request, we identified @dfandrich, @bagder and @danielshahaf to be potential reviewers
Haven't tested it, but looks good to me.
As to call_curl: usually I try to follow the rule that things that call execve() take a list of arguments and things that call system() take a single string argument. call_curl does not follow this rule. I'm not sure this matters — the script is unlikely to be extended in ways which would be affected by this implementation choice — but it's the only potential issue I see in the diff.
I think it needs some extra precaution for cross-compile builds, as then there's no "just built" version of curl around to run.
Various ways to fix cross-builds:
We set a symbol called CROSSCOMPILING for the automakefiles when cross-compiled, and you can see in the tests/Makefile.am for an example use of that. Basically you can do:
bla when cross-compiling
this is for native builds
And the "right" piece will be put into the final makefile by configure.
I think there are two parts to this fix. First part, since cross-builds currently generate a broken zsh completion script, fix that. The first part of this PR does that by having script/zsh.pl die(). Perhaps even forbid --with-zsh-functions-dir for cross-builds at configure (to fail as early as possible).
Second part, how might cross-builds generate a zsh completion script. The Perl script relies on the curl --help output. I see two alternatives: one, have the Perl script parse the help string from tool_help.c directly (after passing that file through the preprocessor to resolve the #ifdef's embedded in the definition of helptext (https://github.com/bagder/curl/blob/5d7c9379efa635a782d7380b1ef899dc1f7f5b29/src/tool_help.c#L46)); two, parse curl --help output not as part of the build process, but as part of the zsh code in the completion script — code that's run whenever the user types curl <TAB> for the first time in a shell session.
Running curl --help each time one does curl is a very bad idea, just disabling zsh completion generation for cross builds makes more sense.
It's not "every time one runs curl", it's only once per shell session: once you do curl <TAB> once in a shell session, the completer won't invoke curl again in that shell instance.
And please explain why you think it's a bad idea. Shelling out to the target command is common practice: 119 out of 801 completers in the zsh distribution invoke _call_program.
If it's once per shell its more than fine, its good :-) Thanks!
scripts: fix zsh completion generation
The script should use the just-built curl, not the system one. This fixes
zsh completion generation when no system curl is installed.
zsh.pl: fail if no curl is found
Instead of generation a broken completion file.
scripts: don't generate and install zsh completion when cross-compiling
@bagder added commit to disable completion generation/installation when cross-compiling (not sure if there's a smarter way to do it).
Thanks a lot, these commits have now been merged as of commit ebfe00c. If anyone has any further improvements on the zsh completions, please just file another issue or PR!