From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Fixing Windows and DOS command line argument quoting Date: Mon, 25 Apr 2011 02:22:31 -0700 Message-ID: <4DB53D57.9030606@gmail.com> References: <4DB4D7DB.50101@gmail.com> <83y62yal3o.fsf@gnu.org> <4DB53599.8040703@gmail.com> <4DB537BB.1090205@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigE0F85D094B598D67C13CFA76" X-Trace: dough.gmane.org 1303723375 9599 80.91.229.12 (25 Apr 2011 09:22:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 25 Apr 2011 09:22:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jason Rumney Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 25 11:22:51 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QEI0G-0003ek-5E for ged-emacs-devel@m.gmane.org; Mon, 25 Apr 2011 11:22:48 +0200 Original-Received: from localhost ([::1]:56012 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEI0F-00017c-Dx for ged-emacs-devel@m.gmane.org; Mon, 25 Apr 2011 05:22:47 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEI0C-00017M-Fp for emacs-devel@gnu.org; Mon, 25 Apr 2011 05:22:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEI0B-0004WF-Jz for emacs-devel@gnu.org; Mon, 25 Apr 2011 05:22:44 -0400 Original-Received: from mail-pv0-f169.google.com ([74.125.83.169]:46448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEI05-0004V2-Ou; Mon, 25 Apr 2011 05:22:37 -0400 Original-Received: by pvc12 with SMTP id 12so1363191pvc.0 for ; Mon, 25 Apr 2011 02:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:x-enigmail-version:content-type; bh=5M6JJ5dKrpa1vgNMVbSi8dVWJ44iwpNmC+g8MzmGw3Q=; b=OpxN9EqD1Ef5bCl6EDte9XpoIWsrQ5+Co7hAKZypWKb41u6WIOt7Kqw8KcDkCk5Cmu gz2gPzT/Xq1CECOTX97izbvpD2Nqqz5bGga5mksNIvVnlbjhmZbdhqriWDPjtUi7bF49 oNaDYupw0QTJz/nu0EQwYL22qcPjODEy8qeks= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; b=udE8zU7ITKSeOhDRXZMqOcokEwRN6n+SdeP8BWnE8Ho23XPBJyNIdiLJPSNdRVtNNB YkqDL4SUU1odVvqLYBDUECh8A4IVC8aVmV9a3EclkrA2VCyK3dUr5XmAupQ/F1QfyOT3 v5Ocput1DEDZQjvq/6Y3QymCklatm26s4FEvM= Original-Received: by 10.68.44.197 with SMTP id g5mr1985798pbm.509.1303723356371; Mon, 25 Apr 2011 02:22:36 -0700 (PDT) Original-Received: from [192.168.1.2] (c-67-183-23-114.hsd1.wa.comcast.net [67.183.23.114]) by mx.google.com with ESMTPS id j8sm3796281pbc.24.2011.04.25.02.22.34 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Apr 2011 02:22:35 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 In-Reply-To: <4DB537BB.1090205@gnu.org> X-Enigmail-Version: 1.1.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138711 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE0F85D094B598D67C13CFA76 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 4/25/11 1:58 AM, Jason Rumney wrote: > On 25/04/2011 16:49, Daniel Colascione wrote: >=20 >> 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. >=20 > IIRC, this "optimisation" isn't about saving time, but about avoiding > limitations in cmd.exe where possible. >=20 > Another possibility is to make the decision whether to use cmd.exe or > not based on the presence of "level 2" metacharacters rather than "leve= l > 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. --------------enigE0F85D094B598D67C13CFA76 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iEYEARECAAYFAk21PVkACgkQ17c2LVA10VuCFwCgrO0bKTzpkHz4HKGilXp8soho zEQAoIMiO2h45GFIurhbVYFi8oGE/z33 =UbcG -----END PGP SIGNATURE----- --------------enigE0F85D094B598D67C13CFA76--