"Eric Y. Kow" <[EMAIL PROTECTED]> writes:

> The next question is why put DARCS_ARGUMENT into the environment at all
> when we can just pass the whole command, arguments and all to the shell?
>
> In other words, why is
(1)
>   system $ cmd++" \"$"++var++"\""
> preferable to
(2)
>   system $ cmd++" "++arg
> ?
>
> I'm not sure I understood the comment about not wanting the shell to
> interpret the argument in any way.

This one breaks when arg contains spaces or other special shell syntax
like backquotes (cmd++" "++"darcs`rm -rf ..`/logfile").

A little history what darcs used for starting EDITOR:
- approach (2) without any quoting => breaks with spaces in filename
- simple quoting that catches some cases [1]
- rawSystem without parsing $EDITOR in any way => breaks with EDITOR="emacs -nw"
  since 'emacs -nw' is considered as arg[0] 
- use words for getting a list of strings out of EDITOR => this one
  breaks for an editor installed in a path containing spaces like you noticed
  on IRC and for David's emacs line [3]

So we can either use (2) and teach darcs some more about shell syntax (that's
how mutt handles the problem), use the setEnv trick or use David's trick
for finding out how the shell splits EDITOR into arguments. I think the last
one wouldn't work with crazy settings like EDITOR="dosomething && emacs".

Benedikt

Patch names:
[1] * quote filename passed to $EDITOR
[2] * add exec_interactive and use it instead of system in some places
[3] * fix [issue370], darcs ignored args contained in VISUAL variable


_______________________________________________
darcs-devel mailing list
[email protected]
http://www.abridgegame.org/cgi-bin/mailman/listinfo/darcs-devel

Reply via email to