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: Wed, 30 Jan 2013 19:55:20 +0200 Message-ID: <83wquuh7xz.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1359568591 5754 80.91.229.3 (30 Jan 2013 17:56:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Jan 2013 17:56:31 +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 Wed Jan 30 18:56:51 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 1U0btv-000654-0B for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jan 2013 18:56:47 +0100 Original-Received: from localhost ([::1]:48671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0btd-0000lb-2K for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Jan 2013 12:56:29 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0btZ-0000lT-RW for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2013 12:56:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0btY-0000DF-Kv for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2013 12:56:25 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0btY-0000DB-HL for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2013 12:56:24 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U0bu9-00059k-PJ for bug-gnu-emacs@gnu.org; Wed, 30 Jan 2013 12:57:01 -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: Wed, 30 Jan 2013 17:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13589 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13589-submit@debbugs.gnu.org id=B13589.135956862119813 (code B ref 13589); Wed, 30 Jan 2013 17:57:01 +0000 Original-Received: (at 13589) by debbugs.gnu.org; 30 Jan 2013 17:57:01 +0000 Original-Received: from localhost ([127.0.0.1]:56042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0bu8-00059W-EG for submit@debbugs.gnu.org; Wed, 30 Jan 2013 12:57:00 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:43437) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0bu5-00059N-GM for 13589@debbugs.gnu.org; Wed, 30 Jan 2013 12:56:58 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MHG00D009OZIX00@a-mtaout23.012.net.il> for 13589@debbugs.gnu.org; Wed, 30 Jan 2013 19:55:33 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MHG00D7S9SLEW60@a-mtaout23.012.net.il>; Wed, 30 Jan 2013 19:55:33 +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:70477 Archived-At: > From: Shigeru Fukaya > Date: Thu, 31 Jan 2013 01:36:35 +0900 > > `call-process' wrongly treats those multibyte characters whose > 2nd byte is 0x5c. > It is bacause sys_spawnve in w32proc.c does bad quoting process. > > Bad example: > > (let ((coding-system-for-write 'cp932)) > (call-process "sh" nil t nil "-c" "ls d:/tmp/表*")) > ls: cannot access d:/tmp/表*: No such file or directory > 2 > > Correct example: > > (let ((coding-system-for-write 'cp932)) > (call-process "sh" nil t nil "-c" "ls d:/tmp/表*")) > d:/tmp/表 > d:/tmp/表1 > > d:/tmp/表表: > abc > 0 > > I tried fixing it (after w32.c as a reference). > Additionally, I set uninitialized `escape_char' to 0. Thanks for the report and the patch. Unfortunately, I don't think the solution you suggest is the right one. It is one thing to support only Windows codepages in encoding of file names, as w32.c does: after all, that's the limitation of the OS APIs we use. But imposing the same limitation for encoding command-line arguments to subprocesses is something entirely different. E.g., consider such trivial example as invoking a speller: the encoding used to pass non-ASCII characters on the command line in this case might have nothing at all to do with Windows codepages. We can no longer justify not supporting shift_jis in this case, for example. IOW, using CharNextExA here would impose an unreasonably bad restriction on how subprocesses can be invoked from Emacs. In addition, without also fixing cmdproxy, which does similar things, this is not going to solve the problem, except in a few select cases. E.g., I think it's enough for you to use shell-file-name instead of "sh" to have the command be handed to cmdproxy by default, and then you'll have the same problem there. We need a better, less restricted and more thorough solution. I don't yet know which one. Thanks.