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#6674: PATCH: fix assignment of grep-find-use-xargs on Windows/MS-DOS Date: Tue, 20 Jul 2010 20:28:04 +0300 Message-ID: <83vd8acbbv.fsf@gnu.org> References: <878w564xtc.fsf@telefonica.net> <87vd8a2rxg.fsf@telefonica.net> <87r5iy2ptw.fsf@telefonica.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1279647060 11668 80.91.229.12 (20 Jul 2010 17:31:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Jul 2010 17:31:00 +0000 (UTC) Cc: lekktu@gmail.com, 6674@debbugs.gnu.org To: =?UTF-8?Q?=C3=93scar?= Fuentes Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 20 19:30:58 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ObGef-0000b3-QZ for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Jul 2010 19:30:58 +0200 Original-Received: from localhost ([127.0.0.1]:55937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObGef-0001Tc-8K for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Jul 2010 13:30:57 -0400 Original-Received: from [140.186.70.92] (port=43145 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ObGeZ-0001TX-Q3 for bug-gnu-emacs@gnu.org; Tue, 20 Jul 2010 13:30:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ObGeY-0005eh-Ip for bug-gnu-emacs@gnu.org; Tue, 20 Jul 2010 13:30:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59031) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObGeY-0005ed-GA for bug-gnu-emacs@gnu.org; Tue, 20 Jul 2010 13:30:50 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1ObGbp-0003pm-P5; Tue, 20 Jul 2010 13:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Jul 2010 17:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6674 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6674-submit@debbugs.gnu.org id=B6674.127964686414730 (code B ref 6674); Tue, 20 Jul 2010 17:28:01 +0000 Original-Received: (at 6674) by debbugs.gnu.org; 20 Jul 2010 17:27:44 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObGbY-0003pX-HH for submit@debbugs.gnu.org; Tue, 20 Jul 2010 13:27:44 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ObGbU-0003pS-Tl for 6674@debbugs.gnu.org; Tue, 20 Jul 2010 13:27:42 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0L5V006009T6PT00@a-mtaout22.012.net.il> for 6674@debbugs.gnu.org; Tue, 20 Jul 2010 20:28:04 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.127.61.30]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L5V00M6Z9URUYH0@a-mtaout22.012.net.il>; Tue, 20 Jul 2010 20:28:04 +0300 (IDT) In-reply-to: <87r5iy2ptw.fsf@telefonica.net> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 20 Jul 2010 13:28:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38697 Archived-At: > From: =C3=93scar Fuentes > Date: Tue, 20 Jul 2010 16:24:59 +0200 > Cc: 6674@debbugs.gnu.org >=20 > =C3=93scar Fuentes writes: >=20 > > Agreed. That's a symptom of a more general problem. I have no ide= a of > > what's going on, because if the pipe is not used the command line= for > > `find' is similar on length and the problem doesn't happen. >=20 > Pasting the command on cmd.exe works fine (after replacing / with \= on > the path to `find.exe') >=20 > Executing >=20 > cmd.exe -c >=20 > from cmd.exe fails on a similar way: >=20 > "CS" -o -path "*" no se reconoce como un comando interno o externo, > programa o archivo por lotes ejecutable. >=20 > This looks like a can of worms. Can we apply the patch on the origi= nal > post, so `rgrep' is usable on Windows with the minimal fuss? I see the problem. When the command line includes pipes or redirection, cmdproxy calls cmd.exe to do the job. It does so by invoking the `spawn' function. By trial and error I established that the limit beyond which rgrep fails is 1024 characters. This is consistent with the MSDN documentation of _spawn, e.g. http://msdn.microsoft.com/en-us/library/20y988d2(VS.71).aspx which says: To pass arguments to the new process, give one or more pointers to character strings as arguments in the _spawn call. These character strings form the argument list for the spawned process. The combine= d length of the strings forming the argument list for the new process must not exceed 1024 bytes. [...] Strangely, we use the same _spawn to run commands when there's no pipes or redirection. Perhaps the 1024-character limit is only imposed when cmd.exe is invoked. In general, cmd.exe itself is documented to have a much larger limit on command-line length: 8K on Windows XP. So we could either (1) install =C3=93scar's patch, with the disadvant= age that rgrep will be slower on MS-Windows (because a separate Grep is invoked on each file found by Find), or (2) fix cmdproxy to use a better API, such as CreateProcess, which doesn't have this limitation= . In any case, please do NOT install the patch for the MS-DOS build. A= s I wrote earlier, it does not have this problem.