From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#18745: Date: Sun, 1 Nov 2015 00:20:34 +0100 Message-ID: References: <83611s3z0j.fsf@gnu.org> <83twpb2d8z.fsf@gnu.org> <834mh93az4.fsf@gnu.org> <83vb9oz9rs.fsf@gnu.org> <83pozwyv6m.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113eb046e0400e05236ecce4 X-Trace: ger.gmane.org 1446333741 29454 80.91.229.3 (31 Oct 2015 23:22:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Oct 2015 23:22:21 +0000 (UTC) Cc: 18745@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 01 00:22:12 2015 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 1ZsfTP-00061t-EW for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Nov 2015 00:22:11 +0100 Original-Received: from localhost ([::1]:57311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsfTO-0001nk-M3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Oct 2015 19:22:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsfTJ-0001nd-MY for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2015 19:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZsfTG-0001oA-G8 for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2015 19:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZsfTG-0001o6-DA for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2015 19:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZsfTG-0002Mb-0C for bug-gnu-emacs@gnu.org; Sat, 31 Oct 2015 19:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Oct 2015 23:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18745 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18745-submit@debbugs.gnu.org id=B18745.14463336789034 (code B ref 18745); Sat, 31 Oct 2015 23:22:01 +0000 Original-Received: (at 18745) by debbugs.gnu.org; 31 Oct 2015 23:21:18 +0000 Original-Received: from localhost ([127.0.0.1]:47368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZsfSX-0002Ld-Cw for submit@debbugs.gnu.org; Sat, 31 Oct 2015 19:21:18 -0400 Original-Received: from mail-lf0-f53.google.com ([209.85.215.53]:33352) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZsfSV-0002LT-0b for 18745@debbugs.gnu.org; Sat, 31 Oct 2015 19:21:16 -0400 Original-Received: by lfbf136 with SMTP id f136so34603411lfb.0 for <18745@debbugs.gnu.org>; Sat, 31 Oct 2015 16:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=vp7QKV36zhqm7+D1VxyolChlGo4+vmPAVIwUMDdG6oQ=; b=q2ghgnIXeGi9OzMQqK+GAeWs5N9hGEL49HyI3Oc5VG7UCgvcPAJCq3OiniCx/b+EUW +rNETeDR4Bl1Z5iX2hJu6YvHyeJkUGi6VI1VjfXMXsl+4/x+u5dPgEdcOdthxUBMNBb/ 0f6hjTCJL4l3pEOaB7jnklWbZ381ZKwzf5kT86wKss50kYO6OXC/9rDBse3hLsMGBPEp 2wcEDUqgVFy0kUEHwoDwTlD54kaBrf0KKWGec8Z5g+wW2mdZlFgciUAutk906zdQcCZa 3Eo0Mpe5RvfoXnkUt5yVdkK4uub9+qi0pNMCSgjB82gpbi+AjfRsvLIbDYjmTq7hyOPU PD7A== X-Received: by 10.25.10.216 with SMTP id 207mr799596lfk.80.1446333674174; Sat, 31 Oct 2015 16:21:14 -0700 (PDT) Original-Received: by 10.25.217.135 with HTTP; Sat, 31 Oct 2015 16:20:34 -0700 (PDT) In-Reply-To: <83pozwyv6m.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.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:108249 Archived-At: --001a113eb046e0400e05236ecce4 Content-Type: text/plain; charset=UTF-8 On Fri, Oct 30, 2015 at 9:10 PM, Eli Zaretskii wrote: > If the batch says > > cmd /c echo arg1 = %1, arg2 = %2 > > i.e. invokes cmd.exe from the batch file, does the test still fail? With (with-temp-file batfile (insert "@cmd /c echo arg1 = %1, arg2 = %2\n")) it still works on cmd.exe, fails on tcc.exe > If it still fails, I think making the test more tolerant of the > trailing whitespace is IMO a better alternative than letting it fail. > After all, that trailing space is not what we are testing there. Something like this, you mean? diff --git a/test/automated/process-tests.el b/test/automated/process-tests.el index 1dab615..58a2de7 100644 --- a/test/automated/process-tests.el +++ b/test/automated/process-tests.el @@ -61,15 +61,15 @@ process-test-sentinel-wait-function-working-p ;; to force quoting. (setq batfile (make-temp-file "echo args" nil ".bat")) (with-temp-file batfile - (insert "@echo arg1 = %1, arg2 = %2\n")) + (insert "@echo arg1=%1, arg2=%2\n")) (with-temp-buffer (call-process batfile nil '(t t) t "x &y") - (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n"))) + (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n"))) (with-temp-buffer (call-process-shell-command (mapconcat #'shell-quote-argument (list batfile "x &y") " ") nil '(t t) t) - (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n")))) + (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n")))) (when batfile (delete-file batfile)))))) (ert-deftest process-test-stderr-buffer () warning: LF will be replaced by CRLF in test/automated/process-tests.el. The file will have its original line endings in your working directory. BTW, curiously, the stderr-related tests in the same test file (process-test-stderr-buffer and process-test-stderr-filter) fail sometimes. Much more frequently on TCC than CMD, but they also fail in CMD, as in these examples: C:\...\automated> ..\..\src\emacs.exe -Q -batch -l ert -l process-tests.elc -f ert-run-tests-batch-and-exit Running 5 tests (2015-10-31 23:35:46+0100) passed 1/5 process-test-quoted-batfile passed 2/5 process-test-sentinel-accept-process-output passed 3/5 process-test-sentinel-sit-for Test process-test-stderr-buffer backtrace: #[nil "\306\307C \310 \311 \3121 \313\216\314 \"\211 )0\202 \210 ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc ert-run-test([cl-struct-ert-test process-test-stderr-buffer nil #[ni ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \211@\20 ert-run-tests-batch(nil) ert-run-tests-batch-and-exit() command-line-1(("-l" "ert" "-l" "process-tests.elc" "-f" "ert-run-te command-line() normal-top-level() Test process-test-stderr-buffer condition: (ert-test-failed ((should (with-current-buffer stderr-buffer (goto-char ...) (looking-at "hello stderr!"))) :form (save-current-buffer (set-buffer stderr-buffer) (goto-char (point-min)) (looking-at "hello stderr!")) :value nil)) FAILED 4/5 process-test-stderr-buffer passed 5/5 process-test-stderr-filter Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-31 23:35:47+0100) 1 unexpected results: FAILED process-test-stderr-buffer C:\...\automated> ..\..\src\emacs.exe -Q -batch -l ert -l process-tests.elc -f ert-run-tests-batch-and-exit Running 5 tests (2015-10-31 23:34:42+0100) passed 1/5 process-test-quoted-batfile passed 2/5 process-test-sentinel-accept-process-output passed 3/5 process-test-sentinel-sit-for passed 4/5 process-test-stderr-buffer Test process-test-stderr-filter backtrace: #[nil "\306\307C \310 \311 \3121 \313\216\314 \"\211 )0\202 \210 ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc ert-run-test([cl-struct-ert-test process-test-stderr-filter nil #[ni ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \211@\20 ert-run-tests-batch(nil) ert-run-tests-batch-and-exit() command-line-1(("-l" "ert" "-l" "process-tests.elc" "-f" "ert-run-te command-line() normal-top-level() Test process-test-stderr-filter condition: (ert-test-failed ((should stderr-sentinel-called) :form stderr-sentinel-called :value nil)) FAILED 5/5 process-test-stderr-filter Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-31 23:34:43+0100) 1 unexpected results: FAILED process-test-stderr-filter --001a113eb046e0400e05236ecce4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Fri, Oct 30, 2015 at 9:10 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> If th= e batch says
>
> =C2=A0 cmd /c echo arg1 =3D %1, arg2 =3D %2>
> i.e. invokes cmd.exe from the batch file, does the test still= fail?

With

=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-temp-file batfile
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (insert "@cmd /c echo arg1 =3D %1,= arg2 =3D %2\n"))

it still works on cmd= .exe, fails on tcc.exe

> If it still fails, I t= hink making the test more tolerant of the
> trailing whitespace is IM= O a better alternative than letting it fail.
> After all, that traili= ng space is not what we are testing there.

Somethi= ng like this, you mean?

diff --git a/test/aut= omated/process-tests.el b/test/automated/process-tests.el
index 1= dab615..58a2de7 100644
--- a/test/automated/process-tests.el
+++ b/test/automated/process-tests.el
@@ -61,15 +61,15 @@ p= rocess-test-sentinel-wait-function-working-p
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0;; to force quoting.
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq batfile (make-temp-file "echo = args" nil ".bat"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(with-temp-file batfile
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert "@echo arg1 =3D %1, arg2 =3D %2\n&q= uot;))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert = "@echo arg1=3D%1, arg2=3D%2\n"))
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(with-temp-buffer
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(call-process batfile nil '(t t) t &= quot;x &y")
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(should (string=3D (buffer-string) "arg1 =3D \"x &y\&qu= ot;, arg2 =3D \n")))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(should (string=3D (buffer-string) "arg1=3D\"x &= y\", arg2=3D\n")))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(with-temp-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(call-process-shell-command
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (mapconcat #'shell-quote-argu= ment (list batfile "x &y") " ")
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nil '(t t) t)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(should (string=3D (buf= fer-string) "arg1 =3D \"x &y\", arg2 =3D \n"))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(should (string= =3D (buffer-string) "arg1=3D\"x &y\", arg2=3D\n")))= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when batfile (delete-file ba= tfile))))))
=C2=A0
=C2=A0(ert-deftest process-test-stde= rr-buffer ()
warning: LF will be replaced by CRLF in test/automat= ed/process-tests.el.
The file will have its original line endings= in your working directory.


<= br>
BTW, curiously, the stderr-related tests in the same test fil= e (process-test-stderr-buffer and=C2=A0process-test-stderr-filter) fail som= etimes. Much more frequently on TCC than CMD, but they also fail in CMD, as= in these examples:

C:\...\automated> = ..\..\src\emacs.exe -Q -batch -l ert -l process-tests.elc -f ert-run-tests-= batch-and-exit
Running 5 tests (2015-10-31 23:35:46+0100)
=C2=A0 =C2=A0passed =C2=A01/5 =C2=A0process-test-quoted-batfile
=C2=A0 =C2=A0passed =C2=A02/5 =C2=A0process-test-sentinel-accept-process-= output
=C2=A0 =C2=A0passed =C2=A03/5 =C2=A0process-test-sentinel-= sit-for
Test process-test-stderr-buffer backtrace:
=C2= =A0 #[nil "\306\307C \310 \311 \3121 \313\216\314 =C2=A0 =C2=A0 =C2= =A0\"\211 )0\202 \210
=C2=A0 ert--run-test-internal([cl-str= uct-ert--test-execution-info [cl-struc
=C2=A0 ert-run-test([cl-st= ruct-ert-test process-test-stderr-buffer nil #[ni
=C2=A0 ert-run-= or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p
=C2= =A0 ert-run-tests(t #[385 "\306 \307\"\203G \211\211G\310U\203 \= 211@\20
=C2=A0 ert-run-tests-batch(nil)
=C2=A0 ert-run-= tests-batch-and-exit()
=C2=A0 command-line-1(("-l" &quo= t;ert" "-l" "process-tests.elc" "-f" &qu= ot;ert-run-te
=C2=A0 command-line()
=C2=A0 normal-top-l= evel()
Test process-test-stderr-buffer condition:
=C2= =A0 =C2=A0 (ert-test-failed
=C2=A0 =C2=A0 =C2=A0((should
=C2=A0 =C2=A0 =C2=A0 =C2=A0(with-current-buffer stderr-buffer
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char ...)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(looking-at "hello stderr!")))
=C2= =A0 =C2=A0 =C2=A0 :form
=C2=A0 =C2=A0 =C2=A0 (save-current-buffer=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-buffer stderr-buffer)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(point-min))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (looking-at &q= uot;hello stderr!"))
=C2=A0 =C2=A0 =C2=A0 :value nil))
=
=C2=A0 =C2=A0FAILED =C2=A04/5 =C2=A0process-test-stderr-buffer
=C2=A0 =C2=A0passed =C2=A05/5 =C2=A0process-test-stderr-filter
Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-3= 1 23:35:47+0100)

1 unexpected results:
= =C2=A0 =C2=A0FAILED =C2=A0process-test-stderr-buffer


C:\...\automated> ..\..\src\emacs.exe = -Q -batch -l ert -l process-tests.elc -f ert-run-tests-batch-and-exit
=
Running 5 tests (2015-10-31 23:34:42+0100)
=C2=A0 =C2=A0pass= ed =C2=A01/5 =C2=A0process-test-quoted-batfile
=C2=A0 =C2=A0passe= d =C2=A02/5 =C2=A0process-test-sentinel-accept-process-output
=C2= =A0 =C2=A0passed =C2=A03/5 =C2=A0process-test-sentinel-sit-for
= =C2=A0 =C2=A0passed =C2=A04/5 =C2=A0process-test-stderr-buffer
Te= st process-test-stderr-filter backtrace:
=C2=A0 #[nil "\306\= 307C \310 \311 \3121 \313\216\314 =C2=A0 =C2=A0 =C2=A0\"\211 )0\202 = \210
=C2=A0 ert--run-test-internal([cl-struct-ert--test-executio= n-info [cl-struc
=C2=A0 ert-run-test([cl-struct-ert-test process-= test-stderr-filter nil #[ni
=C2=A0 ert-run-or-rerun-test([cl-stru= ct-ert--stats t [[cl-struct-ert-test p
=C2=A0 ert-run-tests(t #[3= 85 "\306 \307\"\203G \211\211G\310U\203 \211@\20
=C2= =A0 ert-run-tests-batch(nil)
=C2=A0 ert-run-tests-batch-and-exit(= )
=C2=A0 command-line-1(("-l" "ert" "-l&= quot; "process-tests.elc" "-f" "ert-run-te
=C2=A0 command-line()
=C2=A0 normal-top-level()
Test= process-test-stderr-filter condition:
=C2=A0 =C2=A0 (ert-test-fa= iled
=C2=A0 =C2=A0 =C2=A0((should stderr-sentinel-called)
=C2=A0 =C2=A0 =C2=A0 :form stderr-sentinel-called :value nil))
=C2=A0 =C2=A0FAILED =C2=A05/5 =C2=A0process-test-stderr-filter
<= br>
Ran 5 tests, 4 results as expected, 1 unexpected (2015-10-31 = 23:34:43+0100)

1 unexpected results:
=C2= =A0 =C2=A0FAILED =C2=A0process-test-stderr-filter

--001a113eb046e0400e05236ecce4--