From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments Date: Fri, 01 Feb 2013 12:12:57 +0200 Message-ID: <837gmscpg6.fsf@gnu.org> References: <83wquuh7xz.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1359713660 27728 80.91.229.3 (1 Feb 2013 10:14:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2013 10:14:20 +0000 (UTC) Cc: 13589@debbugs.gnu.org To: Shigeru Fukaya Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 11:14:40 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U1Ddm-00029J-7t for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2013 11:14:38 +0100 Original-Received: from localhost ([::1]:42952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1DdU-0003kz-2H for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2013 05:14:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1DdQ-0003kc-VE for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 05:14:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1DdP-0004PZ-QI for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 05:14:16 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1DdP-0004PU-Mp for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 05:14:15 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U1DeA-0004Rj-Ia for bug-gnu-emacs@gnu.org; Fri, 01 Feb 2013 05:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Feb 2013 10:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13589 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: Original-Received: via spool by 13589-submit@debbugs.gnu.org id=B13589.135971364417006 (code B ref 13589); Fri, 01 Feb 2013 10:15:02 +0000 Original-Received: (at 13589) by debbugs.gnu.org; 1 Feb 2013 10:14:04 +0000 Original-Received: from localhost ([127.0.0.1]:58676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1DdE-0004QF-DM for submit@debbugs.gnu.org; Fri, 01 Feb 2013 05:14:04 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:52706) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1DdB-0004Ph-Cm for 13589@debbugs.gnu.org; Fri, 01 Feb 2013 05:14:03 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MHJ00400D7ILR00@a-mtaout23.012.net.il> for 13589@debbugs.gnu.org; Fri, 01 Feb 2013 12:13:11 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MHJ004XDDPTIR20@a-mtaout23.012.net.il>; Fri, 01 Feb 2013 12:13:05 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70558 Archived-At: > From: Shigeru Fukaya > Cc: 13589@debbugs.gnu.org > Date: Fri, 01 Feb 2013 13:50:13 +0900 > > Why I used CharNextExA is I can't find such functions for encoded > strings in Emacs. There aren't any, except when the strings are encoded in UTF-8. > Possible alternative is to change the quoting > process out of binary to elisp code. Or provide some hook for it? We cannot move this to Lisp, I think, because C code calls Fcall_process directly from C. I think the right place for this processing is in Fcall_process, around line 425 of callproc.c, where we encode the command-line arguments and stuff them into new_argv[] array, to be passed to child_setup. Each argument should be quoted _before_ it is encoded, e.g., by running it through a w32-specific function. Since the Emacs internal representation of characters is based on UTF-8, the problem with backslashes incorrectly interpreted cannot happen if we do this processing before encoding the result. We can then remove most of the code in sys_spawnve that quotes special characters, except for quoting argv[0] if it includes whitespace. > And, anyway, could you please initialize 'escape_char' Done in revision 111212 on the emacs-24 branch. > so that we can safely set `w32-quote-process-args' to nil and do > some quoting by ourselves (using advise or something). Note that, even if w32-quote-process-args is nil, the current code in sys_spawnve can still quote some parts of the command arguments, e.g., if an argument is empty. So initializing escape_char to zero is not TRT, IMO; I initialized it to '\' instead. Thanks.