[darcs-devel] darcs patch: quote filename passed to $EDITOR

David Roundy droundy at abridgegame.org
Fri Feb 11 03:35:08 PST 2005


On Thu, Feb 10, 2005 at 02:35:48PM -0500, Benedikt Schmidt wrote:
> Thu Feb 10 20:31:35 CET 2005  Benedikt Schmidt <beschmi at cloaked.de>
>   * quote filename passed to $EDITOR
>   fix bug when working directory contains spaces reported by
>   Steven E. Harris.

The proper solution here would be to call exec, so we won't need to invoke
a shell at all.  Your current fix, for example, will run into problems if
the working directory contains quotes or backslashes.  The catch is that
the current Exec.exec assumes we want to redirect standard input for the
child process, which isn't really what we want when we invoke a text
editor.

I'm applying your patch, which is an improvement, but would rather see
something like

-- like exec but without redirecting stdio...
exec_interactive :: [String] -> IO ExitCode

in the Exec module.  As a starting point, we could just have an
implementation calling system via careful_unwords, which would be
equivalent to your patch, but then the clever C coders could figure out how
to implement this using execvp, at least on posix systems.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list