From: Eli Zaretskii <eliz@gnu.org>
Cc: F.J.Wright@qmul.ac.uk, emacs-devel@gnu.org, emacs-pretest-bug@gnu.org
Subject: Re: Emacsclient/server filename quoting error
Date: Fri, 15 Dec 2006 13:06:16 +0200 [thread overview]
Message-ID: <u1wn1xvtj.fsf@gnu.org> (raw)
In-Reply-To: <f7ccd24b0612150231g1b09b2f5w3d69e0ce59c3b20c@mail.gmail.com> (lekktu@gmail.com)
> Date: Fri, 15 Dec 2006 11:31:18 +0100
> From: "Juanma Barranquero" <lekktu@gmail.com>
> Cc: emacs-pretest-bug@gnu.org, Emacs Devel <emacs-devel@gnu.org>
>
> > 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.
next prev parent reply other threads:[~2006-12-15 11:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <001701c71c53$1be9a9f0$041df159@Monolith>
2006-12-15 10:31 ` Emacsclient/server filename quoting error Juanma Barranquero
2006-12-15 11:06 ` Eli Zaretskii [this message]
2006-12-15 12:07 ` Juanma Barranquero
2006-12-15 14:19 ` Eli Zaretskii
2006-12-15 15:42 ` Juanma Barranquero
2006-12-15 15:50 ` David Kastrup
2006-12-15 16:03 ` Juanma Barranquero
2006-12-15 15:52 ` Eli Zaretskii
2006-12-15 15:14 ` Werner LEMBERG
2006-12-15 15:41 ` Juanma Barranquero
2006-12-15 15:54 ` Eli Zaretskii
2006-12-17 17:24 ` Francis Wright
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=u1wn1xvtj.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=F.J.Wright@qmul.ac.uk \
--cc=emacs-devel@gnu.org \
--cc=emacs-pretest-bug@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).