From: Daniel Colascione <dan.colascione@gmail.com>
To: Ben Key <bkey76@gmail.com>
Cc: Emacs-devel@gnu.org
Subject: Re: Fixing Windows and DOS command line argument quoting
Date: Tue, 26 Apr 2011 18:25:44 -0700 [thread overview]
Message-ID: <4DB77098.4000301@gmail.com> (raw)
In-Reply-To: <BANLkTimBrBqo5b3KYgDkkTVSC5V2PV8hAg@mail.gmail.com>
On 4/26/2011 5:58 PM, Ben Key wrote:
> Daniel Colascione writes:
>
> > After another reading of cmdproxy.c, I also see that the
> > CreateProcess path also doesn't expand environment %variable%
> > references, and that doesn't fall back to cmd if the command
> > to be executed contains them. While we could expand these
> > variables, doing so would move us even closer to
> > reimplementing half of cmd.exe.
>
> You are exaggerating a great deal. It is a single function call,
> ExpandEnvironmentStrings, documented at
> http://msdn.microsoft.com/en-us/library/ms724265%28v=vs.85%29.aspx.
> Patching cmdproxy.c to use ExpandEnvironmentStrings before calling
> CreateProcess would add at most 10 lines of code. This is by no means
> "reimplementing half of cmd.exe."
>
I actually didn't know about ExpandEnvironmentStrings. Thank you for
the link; this function may be useful in some cases. But as the
comments on the linked MSDN page point out, ExpandEnvironmentStrings
doesn't expand variable references quite same way cmd does, and it would
produce incorrect results for us whether we ran it before or after
level-2-dequoting. Since cmdproxy should mimic cmd's processing when
bypassing cmd itself, ExpandEnvironmentStrings would be inappropriate
for our purposes.
The issue is moot, however, because cmdproxy now punts processing
variable references to cmd itself, and I suspect that Eli Zaretskii is
correct when he says that such variable references are rare.
next prev parent reply other threads:[~2011-04-27 1:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 0:58 Fixing Windows and DOS command line argument quoting Ben Key
2011-04-27 1:25 ` Daniel Colascione [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-04-25 2:09 Daniel Colascione
2011-04-25 6:41 ` Eli Zaretskii
2011-04-25 8:49 ` Daniel Colascione
2011-04-25 8:58 ` Jason Rumney
2011-04-25 9:15 ` Eli Zaretskii
2011-04-25 9:22 ` Daniel Colascione
2011-04-25 17:56 ` Daniel Colascione
2011-04-25 18:47 ` Eli Zaretskii
2011-04-26 10:44 ` Daniel Colascione
2011-04-26 17:50 ` Eli Zaretskii
2011-04-25 9:35 ` Eli Zaretskii
2011-04-25 18:24 ` Daniel Colascione
2011-04-25 18:48 ` Eli Zaretskii
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=4DB77098.4000301@gmail.com \
--to=dan.colascione@gmail.com \
--cc=Emacs-devel@gnu.org \
--cc=bkey76@gmail.com \
/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).