GNU logs - #13589, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments 
Resent-From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Jan 2013 16:38:01 +0000
Resent-Message-ID: <handler.13589.B.13595638613754 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 13589
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 13589 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.13595638613754
          (code B ref -1); Wed, 30 Jan 2013 16:38:01 +0000
Received: (at submit) by debbugs.gnu.org; 30 Jan 2013 16:37:41 +0000
Received: from localhost ([127.0.0.1]:55938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U0afM-0000yU-HL
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 11:37:41 -0500
Received: from eggs.gnu.org ([208.118.235.92]:47791)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0afJ-0000yM-HL
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 11:37:39 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0aeb-0002MS-F7
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 11:36:59 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:58682)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0aeb-0002ML-B5
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 11:36:53 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59061)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0aeW-0005H1-Lb
	for bug-gnu-emacs@HIDDEN; Wed, 30 Jan 2013 11:36:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0aeP-0002It-KR
	for bug-gnu-emacs@HIDDEN; Wed, 30 Jan 2013 11:36:48 -0500
Received: from mail-pa0-f47.google.com ([209.85.220.47]:40812)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U0aeP-0002If-Av
	for bug-gnu-emacs@HIDDEN; Wed, 30 Jan 2013 11:36:41 -0500
Received: by mail-pa0-f47.google.com with SMTP id bj3so22911pad.34
	for <bug-gnu-emacs@HIDDEN>; Wed, 30 Jan 2013 08:36:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=x-received:from:to:subject:date:mime-version:content-type
	:content-transfer-encoding:x-mailer:message-id;
	bh=X3HWCHhevMd4KFpHOfqS5pDyYK8eWN1zx6T2VbMTt68=;
	b=0zdMQ3xukYOCVq0E+2go47++I4g9mqwZsuRJkI1Uvkf1lyLasfPMUGwpDTNWWv3MHN
	wf4zdnKsQu3vhw4tCxkIM1sWNpcWfCMGvbgg7MI6xG6r0FwubWJLWrPsy9LKmqTVNjVv
	YhaJ/7CIXLpDguIRxjnj0UYTarlRPIZ6Gf0oFy7egpdeiiieUJDza1ZEYl28z1hyMLEn
	mfZL3t4kFX0NvOfkYII0/F1V2LqXz+LLzEoUixi5xFPHMgDyMmstVSLdH3qIjHUtaHqZ
	FaYpn0iCbhipS2oqDYlPargRk3orWCcUXq8RmcKW801sXPJUky75nnGJBwJ6NBbclp8i
	Qpqw==
X-Received: by 10.66.81.199 with SMTP id c7mr12652482pay.39.1359563800035;
	Wed, 30 Jan 2013 08:36:40 -0800 (PST)
Received: from gmail.com (115x125x38x6.ap115.ftth.ucom.ne.jp. [115.125.38.6])
	by mx.google.com with ESMTPS id
	sb3sm2030686pbc.44.2013.01.30.08.36.36
	(version=TLSv1 cipher=RC4-SHA bits=128/128);
	Wed, 30 Jan 2013 08:36:38 -0800 (PST)
From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Date: Thu, 31 Jan 2013 01:36:35 +0900
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
X-Mailer: HidemaruMail 6.00 (WinNT,601)
Message-Id: <B1CDFF07F821D1shigeru.fukaya@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -3.4 (---)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Hi,

`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.

Note that coding of command lines is different from coding of process inputs.

Regards,
Shigeru


*** w32proc.c	Thu Jan 31 01:06:10 2013
--- w32proc.old.c	Sun Jan 27 11:32:55 2013
***************
*** 1419,1488 ****
    *nptr = NULL;
  }
  
- 
- /* Code copied from max_filename_mbslen in w32.c */
- 
- /* Current codepage for encoding command lines.  */
- static int command_line_codepage;
- 
- /* Return the maximum length in bytes of a multibyte character
-    sequence encoded in the current ANSI codepage.  This is required to
-    correctly walk the encoded file names one character at a time.  */
- static int
- max_cmdline_mbslen (void)
- {
-   /* A simple cache to avoid calling GetCPInfo every time we need to
-      normalize a file name.  The file-name encoding is not supposed to
-      be changed too frequently, if ever.  */
-   static Lisp_Object last_cmdline_encoding;
-   static int last_max_mbslen;
-   Lisp_Object current_encoding;
- 
-   current_encoding = Vcoding_system_for_write;
- 
-   if (!EQ (last_cmdline_encoding, current_encoding))
-     {
-       CPINFO cp_info;
- 
-       last_cmdline_encoding = current_encoding;
-       /* Default to the current ANSI codepage.  */
-       command_line_codepage = w32_ansi_code_page;
-       if (!NILP (current_encoding))
- 	{
- 	  char *cpname = SDATA (SYMBOL_NAME (current_encoding));
- 	  char *cp = NULL, *end;
- 	  int cpnum;
- 
- 	  if (strncmp (cpname, "cp", 2) == 0)
- 	    cp = cpname + 2;
- 	  else if (strncmp (cpname, "windows-", 8) == 0)
- 	    cp = cpname + 8;
- 
- 	  if (cp)
- 	    {
- 	      end = cp;
- 	      cpnum = strtol (cp, &end, 10);
- 	      if (cpnum && *end == '\0' && end - cp >= 2)
- 		command_line_codepage = cpnum;
- 	    }
- 	}
- 
-       if (!command_line_codepage)
- 	command_line_codepage = CP_ACP; /* CP_ACP = 0, but let's not assume that */
- 
-       if (!GetCPInfo (command_line_codepage, &cp_info))
- 	{
- 	  command_line_codepage = CP_ACP;
- 	  if (!GetCPInfo (command_line_codepage, &cp_info))
- 	    emacs_abort ();
- 	}
-       last_max_mbslen = cp_info.MaxCharSize;
-     }
- 
-   return last_max_mbslen;
- }
- 
- 
  /* When a new child process is created we need to register it in our list,
     so intercept spawn requests.  */
  int
--- 1419,1424 ----
***************
*** 1495,1501 ****
    child_process *cp;
    int is_dos_app, is_cygnus_app, is_gui_app;
    int do_quoting = 0;
!   char escape_char = 0;
    /* We pass our process ID to our children by setting up an environment
       variable in their environment.  */
    char ppid_env_var_buffer[64];
--- 1431,1437 ----
    child_process *cp;
    int is_dos_app, is_cygnus_app, is_gui_app;
    int do_quoting = 0;
!   char escape_char;
    /* We pass our process ID to our children by setting up an environment
       variable in their environment.  */
    char ppid_env_var_buffer[64];
***************
*** 1508,1514 ****
       Some extra whitespace characters need quoting in Cygwin programs,
       so this list is conditionally modified below.  */
    char *sepchars = " \t*?";
-   int dbcs_p = max_cmdline_mbslen () > 1;
  
    /* We don't care about the other modes */
    if (mode != _P_NOWAIT)
--- 1444,1449 ----
***************
*** 1622,1628 ****
  
        if (*p == 0)
  	need_quotes = 1;
!       for ( ; *p; p = !dbcs_p ? p + 1 : CharNextExA (command_line_codepage, p, 0))
  	{
  	  if (escape_char == '"' && *p == '\\')
  	    /* If it's a Cygwin app, \ needs to be escaped.  */
--- 1557,1563 ----
  
        if (*p == 0)
  	need_quotes = 1;
!       for ( ; *p; p++)
  	{
  	  if (escape_char == '"' && *p == '\\')
  	    /* If it's a Cygwin app, \ needs to be escaped.  */
***************
*** 1674,1680 ****
  
        if (do_quoting)
  	{
! 	  for ( ; *p; p = !dbcs_p ? p + 1 : CharNextExA (command_line_codepage, p, 0))
  	    if ((strchr (sepchars, *p) != NULL) || *p == '"')
  	      need_quotes = 1;
  	}
--- 1609,1615 ----
  
        if (do_quoting)
  	{
! 	  for ( ; *p; p++)
  	    if ((strchr (sepchars, *p) != NULL) || *p == '"')
  	      need_quotes = 1;
  	}
***************
*** 1702,1708 ****
  	      *parg++ = *p++;
  	    }
  #else
! 	  while (*p)
  	    {
  	      if (*p == '"')
  		{
--- 1637,1643 ----
  	      *parg++ = *p++;
  	    }
  #else
! 	  for ( ; *p; p++)
  	    {
  	      if (*p == '"')
  		{
***************
*** 1717,1736 ****
  		}
  	      else if (escape_char == '"' && *p == '\\')
  		*parg++ = '\\';
  
  	      if (*p == escape_char && escape_char != '"')
  		escape_char_run++;
  	      else
  		escape_char_run = 0;
- 	      if (!dbcs_p)
- 		*parg++ = *p++;
- 	      else
- 		{
- 		  char *p1 = CharNextExA (command_line_codepage, p, 0);
- 
- 		  while (p < p1)
- 		    *parg++ = *p++;
- 		}
  	    }
  	  /* double escape chars before enclosing quote */
  	  while (escape_char_run > 0)
--- 1652,1663 ----
  		}
  	      else if (escape_char == '"' && *p == '\\')
  		*parg++ = '\\';
+ 	      *parg++ = *p;
  
  	      if (*p == escape_char && escape_char != '"')
  		escape_char_run++;
  	      else
  		escape_char_run = 0;
  	    }
  	  /* double escape chars before enclosing quote */
  	  while (escape_char_run > 0)




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.428 (Entity 5.428)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Subject: bug#13589: Acknowledgement (24.2.92; wrongly escaped call-process
 arguments )
Message-ID: <handler.13589.B.13595638613754.ack <at> debbugs.gnu.org>
References: <B1CDFF07F821D1shigeru.fukaya@HIDDEN>
X-Gnu-PR-Message: ack 13589
X-Gnu-PR-Package: emacs
Reply-To: 13589 <at> debbugs.gnu.org
Date: Wed, 30 Jan 2013 16:38:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 13589 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
13589: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D13589
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 30 Jan 2013 17:57:01 +0000
Resent-Message-ID: <handler.13589.B13589.135956862119813 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 13589
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Cc: 13589 <at> debbugs.gnu.org
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 13589-submit <at> debbugs.gnu.org id=B13589.135956862119813
          (code B ref 13589); Wed, 30 Jan 2013 17:57:01 +0000
Received: (at 13589) by debbugs.gnu.org; 30 Jan 2013 17:57:01 +0000
Received: from localhost ([127.0.0.1]:56042 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U0bu8-00059W-EG
	for submit <at> debbugs.gnu.org; Wed, 30 Jan 2013 12:57:00 -0500
Received: from mtaout23.012.net.il ([80.179.55.175]:43437)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1U0bu5-00059N-GM
	for 13589 <at> debbugs.gnu.org; Wed, 30 Jan 2013 12:56:58 -0500
Received: from conversion-daemon.a-mtaout23.012.net.il by
	a-mtaout23.012.net.il (HyperSendmail v2007.08) id
	<0MHG00D009OZIX00@HIDDEN> for
	13589 <at> debbugs.gnu.org; Wed, 30 Jan 2013 19:55:33 +0200 (IST)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0MHG00D7S9SLEW60@HIDDEN>;
	Wed, 30 Jan 2013 19:55:33 +0200 (IST)
Date: Wed, 30 Jan 2013 19:55:20 +0200
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <B1CDFF07F821D1shigeru.fukaya@HIDDEN>
X-012-Sender: halo1@HIDDEN
Message-id: <83wquuh7xz.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-2022-jp
Content-transfer-encoding: 8bit
References: <B1CDFF07F821D1shigeru.fukaya@HIDDEN>
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
	has
	identified this incoming email as possible spam. The original message
	has been attached to this so you can view it (if it isn't spam) or
	label similar future email.  If you have any questions, see
	the administrator of that system for details.
	Content preview: > From: Shigeru Fukaya <shigeru.fukaya@HIDDEN> >
	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 =?UTF-8?Q?d:/tmp/=1B$BI=3D=1B?=(B*")) >
	ls:
	cannot access =?UTF-8?Q?d:/tmp/=1B$BI=3D=1B?=(B*: No such file or directory > 2 > >
	Correct
	example: > > (let ((coding-system-for-write 'cp932)) > (call-process
	"sh" nil t nil "-c" "ls =?UTF-8?Q?d:/tmp/=1B$BI=3D=1B?=(B*")) > =?UTF-8?Q?d:/tmp/=1B$BI=3D=1B?=(B >
	=?UTF-8?Q?d:/tmp/=1B$BI=3D=1B?=(B1
	> > =?UTF-8?Q?d:/tmp/=1B$BI=3DI=3D=1B?=(B: > abc > 0 > > I tried fixing it (after w32.c as
	a reference). > Additionally,
	I set uninitialized `escape_char' to 0. [...] 
	Content analysis details:   (1.5 points, 10.0 required)
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,
	no trust [80.179.55.175 listed in list.dnswl.org]
	0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
	0.8 BAYES_50               BODY: Bayes spam probability is 40 to 60%
	[score: 0.4861]
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.7 (/)

> From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments
Resent-From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 01 Feb 2013 04:52:02 +0000
Resent-Message-ID: <handler.13589.B13589.135969426621050 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 13589
X-GNU-PR-Package: emacs,w32
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: 13589 <at> debbugs.gnu.org
Received: via spool by 13589-submit <at> debbugs.gnu.org id=B13589.135969426621050
          (code B ref 13589); Fri, 01 Feb 2013 04:52:02 +0000
Received: (at 13589) by debbugs.gnu.org; 1 Feb 2013 04:51:06 +0000
Received: from localhost ([127.0.0.1]:58410 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U18ag-0005TS-7j
	for submit <at> debbugs.gnu.org; Thu, 31 Jan 2013 23:51:06 -0500
Received: from mail-da0-f51.google.com ([209.85.210.51]:38195)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <shigeru.fukaya@HIDDEN>) id 1U18ad-0005TK-MD
	for 13589 <at> debbugs.gnu.org; Thu, 31 Jan 2013 23:51:04 -0500
Received: by mail-da0-f51.google.com with SMTP id i30so1579941dad.24
	for <13589 <at> 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)
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)
From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Date: Fri, 01 Feb 2013 13:50:13 +0900
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
X-Mailer: HidemaruMail 6.00 (WinNT,601)
In-Reply-To: <83wquuh7xz.fsf@HIDDEN>
References: <B1CDFF07F821D1shigeru.fukaya@HIDDEN> <83wquuh7xz.fsf@HIDDEN>
Message-Id: <B3CE00379EFEA7shigeru.fukaya@HIDDEN>
X-Spam-Score: 0.1 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

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 <shigeru.fukaya@HIDDEN>
>> 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.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 01 Feb 2013 10:15:02 +0000
Resent-Message-ID: <handler.13589.B13589.135971364417006 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 13589
X-GNU-PR-Package: emacs,w32
X-GNU-PR-Keywords: 
To: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
Cc: 13589 <at> debbugs.gnu.org
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Received: via spool by 13589-submit <at> debbugs.gnu.org id=B13589.135971364417006
          (code B ref 13589); Fri, 01 Feb 2013 10:15:02 +0000
Received: (at 13589) by debbugs.gnu.org; 1 Feb 2013 10:14:04 +0000
Received: from localhost ([127.0.0.1]:58676 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1U1DdE-0004QF-DM
	for submit <at> debbugs.gnu.org; Fri, 01 Feb 2013 05:14:04 -0500
Received: from mtaout23.012.net.il ([80.179.55.175]:52706)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eliz@HIDDEN>) id 1U1DdB-0004Ph-Cm
	for 13589 <at> debbugs.gnu.org; Fri, 01 Feb 2013 05:14:03 -0500
Received: from conversion-daemon.a-mtaout23.012.net.il by
	a-mtaout23.012.net.il (HyperSendmail v2007.08) id
	<0MHJ00400D7ILR00@HIDDEN> for
	13589 <at> debbugs.gnu.org; Fri, 01 Feb 2013 12:13:11 +0200 (IST)
Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0MHJ004XDDPTIR20@HIDDEN>;
	Fri, 01 Feb 2013 12:13:05 +0200 (IST)
Date: Fri, 01 Feb 2013 12:12:57 +0200
From: Eli Zaretskii <eliz@HIDDEN>
In-reply-to: <B3CE00379EFEA7shigeru.fukaya@HIDDEN>
X-012-Sender: halo1@HIDDEN
Message-id: <837gmscpg6.fsf@HIDDEN>
References: <B1CDFF07F821D1shigeru.fukaya@HIDDEN> <83wquuh7xz.fsf@HIDDEN>
	<B3CE00379EFEA7shigeru.fukaya@HIDDEN>
X-Spam-Score: 1.5 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
	has
	identified this incoming email as possible spam. The original message
	has been attached to this so you can view it (if it isn't spam) or
	label similar future email.  If you have any questions, see
	the administrator of that system for details.
	Content preview: > From: Shigeru Fukaya <shigeru.fukaya@HIDDEN> >
	Cc: 13589 <at> 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. [...] 
	Content analysis details:   (1.5 points, 10.0 required)
	pts rule name              description
	---- ----------------------
	--------------------------------------------------
	-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,
	no trust [80.179.55.175 listed in list.dnswl.org]
	0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail)
	0.8 BAYES_50               BODY: Bayes spam probability is 40 to 60%
	[score: 0.4808]
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: 0.2 (/)

> From: Shigeru Fukaya <shigeru.fukaya@HIDDEN>
> Cc: 13589 <at> 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.




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 25 Mar 2017 04:05:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 25 00:05:33 2017
Received: from localhost ([127.0.0.1]:43064 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1crcxJ-000072-2Q
	for submit <at> debbugs.gnu.org; Sat, 25 Mar 2017 00:05:33 -0400
Received: from mail-it0-f53.google.com ([209.85.214.53]:34940)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1crcxI-00006p-Ar
 for control <at> debbugs.gnu.org; Sat, 25 Mar 2017 00:05:32 -0400
Received: by mail-it0-f53.google.com with SMTP id y18so27715054itc.0
 for <control <at> debbugs.gnu.org>; Fri, 24 Mar 2017 21:05:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:subject:date:message-id:mime-version;
 bh=6AZC+dlBvdDNBqnrgUj2AcN5lkOsPcKFyGnOk1ePvts=;
 b=p18AFChPV52CJsY3cB0QD3P3swlGyPHUFhQbmaZN4znzLS1oI27FdpgaemSdZD4a+z
 e6Vdzfz1CXLQNixSkinhKlguBnButqtcBU5ck9WQVJpg+7ZlUcQzDVs/YZQzEbA3yGW0
 7I0OL+lpC8SclDs2Y0UTm1o4kDyG3MGpxtb5MLBtIvA4m0swewATIEX94kfVUV1HXkxc
 wJTPTDYJewSp7q8omyLIBz76O8v9SHPbVQEM4A2QNfI+8W6frwjaYbLSpdx3G95c/LfK
 u0xYqEHiWTwdaOKtMujSDMWpJ5zFEPsY0mbEFA8Y5E8Kvpp/Ai1HjUZHSmcFYLKk7Q7x
 f2yA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:subject:date:message-id
 :mime-version;
 bh=6AZC+dlBvdDNBqnrgUj2AcN5lkOsPcKFyGnOk1ePvts=;
 b=JJS9IKtyT5N8NbL/072uTm47vtYGtdJvvN/3mibg/YFVvbEbWT3X2nf4FbVW2Rt2AO
 8WNP7Tf/2bj7/8bUGXJhDv7VGe6kZ1dZ/6yfimncez6cMdVdyCVXXsCLS69+2RZral8a
 eJP8ORJYi+wWnbl/CLItpTrnHmJYNIw90zCIjM9j5fQucwqgPRq3vAOugbuE7pVgQv36
 gMpanYd3+BuX6zPGEhxfwqYQEh83XIYauxCY2Zp9rFMrtIKY7jeUSCjuZNM+EaUwagCL
 vL7/q+uLWx8XyYMLwoFgVCM3eO+ox8vIRBrcNsb/6cz8i+uX9EWSdz9UK0/NSy6PG8y7
 h5Gg==
X-Gm-Message-State: AFeK/H0ql2UFBP9HmYVoFOBkDCUf2lDv4k5+JkWp+R+ztsJp5M3SfCyXCw7BhgIsw0oZWw==
X-Received: by 10.36.69.234 with SMTP id c103mr73071itd.78.1490414726670;
 Fri, 24 Mar 2017 21:05:26 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id n6sm1978409itb.25.2017.03.24.21.05.25
 for <control <at> debbugs.gnu.org>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 24 Mar 2017 21:05:26 -0700 (PDT)
From: npostavs@HIDDEN
To: control <at> debbugs.gnu.org
Subject: control message for bug #13589
Date: Sat, 25 Mar 2017 00:06:49 -0400
Message-ID: <87r31m0zl2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

retitle 13589 24.2.92; [w32] wrongly escaped call-process of multibyte arguments
quit






Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.