emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacsclient/server filename quoting error


From: Eli Zaretskii
Subject: Re: Emacsclient/server filename quoting error
Date: Fri, 15 Dec 2006 13:06:16 +0200

> Date: Fri, 15 Dec 2006 11:31:18 +0100
> From: "Juanma Barranquero" <address@hidden>
> Cc: address@hidden, Emacs Devel <address@hidden>
> 
> > I execute all the following commands from a cmd command
> > prompt (outside of Emacs).
> >
> > emacsclient -n -a runemacs "TO DO.txt"
> >
> > works correctly if Emacs IS already running, but if it is not
> > already running then Emacs does not see the filename correctly;
> > the quotes do not appear to be passed on to runemacs.
> 
> The following patch addresses the issue by allocating quoted copies of
> any argument containing spaces before calling execvp.
> 
> Any objections to install this fix? As it stands, it affects also
> non-Windows builds. Is requoting args the right behavior in these
> environments?

Quoting arguments passed to execvp is _definitely_ the wrong thing for
Posix platforms.  The fact that we need to do that for Windows is due
to the broken implementation of exec* routines in the Microsoft
libraries: they concatenate the arguments together without quoting
special characters, and pass the result to CreateProcess, with
predictably bad results.

By contrast, Posix execvp passes the arguments directly into the
argv[] array of the child process.

So please make this change conditioned on WINDOWSNT.

Actually, a cleaner way of fixing this would be to have a
WINDOWSNT-only wrapper for execvp, called, say w32_execvp, that does
TRT with quoting the arguments.  Then you could say

  #ifdef WINDOWSNT
  #define execvp w32_execvp
  #endif

in emacsclient.c, and leave the mainline code intact.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]