unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dan.colascione@gmail.com>
To: Jason Rumney <jasonr@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Fixing Windows and DOS command line argument quoting
Date: Mon, 25 Apr 2011 02:22:31 -0700	[thread overview]
Message-ID: <4DB53D57.9030606@gmail.com> (raw)
In-Reply-To: <4DB537BB.1090205@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

On 4/25/11 1:58 AM, Jason Rumney wrote:
> On 25/04/2011 16:49, Daniel Colascione wrote:
> 
>> 1. we can have cmdproxy level-two-dequote the supplied command line
>> before giving it to CreateProcess, or
>>
>> 2. we can remove optimization described above and have cmdproxy always
>> run the command interpreter.
>>
>> I favor the second option: cmd starts very quickly, and we don't save
>> much time by bypassing it.
> 
> IIRC, this "optimisation" isn't about saving time, but about avoiding
> limitations in cmd.exe where possible.
> 
> Another possibility is to make the decision whether to use cmd.exe or
> not based on the presence of "level 2" metacharacters rather than "level
> 1".

I see. Is it just the length limit?

CreateProcess supports 32kb of command line; cmd supports 8kb.  If the
extra 24kb is important, then we can do what you suggest:
shell-quote-argument would also to be further modified to only use level
2 metacharacters when strictly necessary.  Bear in mind that the new
limit would apply only to *shell* commands explicitly, not to subprocess
invocations in general, which would continue to be handled directly by
the code in w32proc.  Besides, I think it's counter-intuitive for a
shell pipeline to stop working merely because it contains more than one
command.

Also, my objection regarding false positives arising from shell
metacharacters embedded in quoted arguments stands: if users do rely on
the successful execution of long, simple shell command lines, these
commands should not break merely because they contain *quoted* shell
metacharacters.  We could have cmdproxy distinguish between quoted and
unquoted metacharacters, but at that point, we could just add
level-2-dequoting as well and solve the problem that way.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2011-04-25  9:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25  2:09 Fixing Windows and DOS command line argument quoting 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 [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2011-04-27  0:58 Ben Key
2011-04-27  1:25 ` Daniel Colascione

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=4DB53D57.9030606@gmail.com \
    --to=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jasonr@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).