From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Shigeru Fukaya Newsgroups: gmane.emacs.bugs Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments Date: Fri, 01 Feb 2013 13:50:13 +0900 Message-ID: References: <83wquuh7xz.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1359694282 28707 80.91.229.3 (1 Feb 2013 04:51:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2013 04:51:22 +0000 (UTC) Cc: 13589@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 05:51:41 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 1U18bF-00053u-Jz for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Feb 2013 05:51:41 +0100 Original-Received: from localhost ([::1]:46689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U18ax-0001pr-Ih for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Jan 2013 23:51:23 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:56653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U18at-0001pl-K2 for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 23:51:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U18ar-0005Ai-5c for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 23:51:19 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52946) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U18ar-0005AW-1W for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 23:51:17 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U18ba-0005Ub-Dp for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 23:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Shigeru Fukaya Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Feb 2013 04:52: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.135969426621050 (code B ref 13589); Fri, 01 Feb 2013 04:52:02 +0000 Original-Received: (at 13589) by debbugs.gnu.org; 1 Feb 2013 04:51:06 +0000 Original-Received: from localhost ([127.0.0.1]:58410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U18ag-0005TS-7j for submit@debbugs.gnu.org; Thu, 31 Jan 2013 23:51:06 -0500 Original-Received: from mail-da0-f51.google.com ([209.85.210.51]:38195) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U18ad-0005TK-MD for 13589@debbugs.gnu.org; Thu, 31 Jan 2013 23:51:04 -0500 Original-Received: by mail-da0-f51.google.com with SMTP id i30so1579941dad.24 for <13589@debbugs.gnu.org>; Thu, 31 Jan 2013 20:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:mime-version:content-type :content-transfer-encoding:x-mailer:in-reply-to:references :message-id; bh=gm1PWAe5h29763TIbsclrmNFrx+ihV1aIJ+tLY6Ww8A=; b=PY04sMv0pW7uuFjeE7vm0p/5VXf5lx5RUV9lL5HzLy1yo17xjYqiAVPP8bsQOnMFPT AwBG6DzaD0+s/o0DwnjUxSD9TznmXDG+irlR1AtOwSxs4RPtF10c1AF6LL2HhuZJysLu fxO2sdSc1ad4MJ0wNCmsGUJ1vSW4w5EEfhPBxX2afblXCaYxF7SULNamVMCaTT/zSF+O Gp7JS+StzQA027QejWzHT+m2kXLhGnGVFc8G9OD8Fb52qAIju/8BDew1y5HykIyxb5Cw 1sZBFfKjHX5TdfYFb3yr8E4hjiUatmIraojRq6q21wirskTTyEv01++GdFL19MygcOsW 2zxQ== X-Received: by 10.68.219.67 with SMTP id pm3mr28712767pbc.150.1359694216694; Thu, 31 Jan 2013 20:50:16 -0800 (PST) Original-Received: from gmail.com (115x125x38x6.ap115.ftth.ucom.ne.jp. [115.125.38.6]) by mx.google.com with ESMTPS id gj1sm7170264pbc.11.2013.01.31.20.50.13 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 31 Jan 2013 20:50:15 -0800 (PST) X-Mailer: HidemaruMail 6.00 (WinNT,601) In-Reply-To: <83wquuh7xz.fsf@gnu.org> 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:70550 Archived-At: Thank you for your reply. Why I used CharNextExA is I can't find such functions for encoded strings in Emacs. Possible alternative is to change the quoting process out of binary to elisp code. Or provide some hook for it? And, anyway, could you please initialize 'escape_char', so that we can safely set `w32-quote-process-args' to nil and do some quoting by ourselves (using advise or something). Shigeru >> 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.