From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 09 06:30:29 2012 Received: (at submit) by debbugs.gnu.org; 9 Jan 2012 11:30:29 +0000 Received: from localhost ([127.0.0.1]:50728 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkDQn-00044B-Bf for submit@debbugs.gnu.org; Mon, 09 Jan 2012 06:30:29 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35870) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkDQg-00043u-Jw for submit@debbugs.gnu.org; Mon, 09 Jan 2012 06:30:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkDQH-0007Nx-Qz for submit@debbugs.gnu.org; Mon, 09 Jan 2012 06:29: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=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:54661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDQH-0007Nt-Oa for submit@debbugs.gnu.org; Mon, 09 Jan 2012 06:29:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDQD-0005ab-J2 for bug-automake@gnu.org; Mon, 09 Jan 2012 06:29:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkDQ9-0007Mr-3p for bug-automake@gnu.org; Mon, 09 Jan 2012 06:29:49 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:56816) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkDQ8-0007Mf-MS for bug-automake@gnu.org; Mon, 09 Jan 2012 06:29:45 -0500 Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id D282A40006 for ; Mon, 9 Jan 2012 12:29:41 +0100 (CET) Received: from [192.168.0.150] (h57n3fls301o1095.telia.com [81.230.178.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 9A69640005 for ; Mon, 9 Jan 2012 12:29:41 +0100 (CET) Message-ID: <4F0ACFA6.40609@lysator.liu.se> Date: Mon, 09 Jan 2012 12:29:42 +0100 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: bug-automake@gnu.org Subject: MSYS problem with redirects Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) Hi! parallel-tests-fd-redirect.test fails on MSYS, and I think the cause is that the write (9, ...) simply doesn't work for MinGW programs (baz.exe and qux.test.exe). It works for the shell scripts (foo.sh and bar) since /bin/sh is an MSYS program and thus is a lot more POSIXy. But redirecting from the MinGW world to the MSYS world in this maner is simply not possible, I think. I think that will only work for fd 0,1 and 2 (but I'm not 100% sure). Also, including unistd.h will not work for non-ANSI systems, MinGW provides a half-baked unistd.h but MSVC does not. MSVC has its write() in io.h, but it will probably suffer from the same problem with a dysfunctional fd 9. With this diff: diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-red index 73a134e..5728014 100755 --- a/tests/parallel-tests-fd-redirect.test +++ b/tests/parallel-tests-fd-redirect.test @@ -65,20 +65,26 @@ END chmod a+x foo.sh bar cat > baz.c <<'END' +#include #include int main (void) { - write (9, " bazbazbaz\n", 11); - return 0; + ssize_t res = write (9, " bazbazbaz\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END cat > zardoz.c <<'END' +#include #include int main (void) { - write (9, " quxquxqux\n", 11); - return 0; + ssize_t res = write (9, " quxquxqux\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END the embedded test suite goes from 4 PASS to 2 PASS / 2 FAIL, and this in the log files: + cat foo.log + cat bar.log + cat baz.log write failed: Bad file descriptor + cat qux.log write failed: Bad file descriptor supporting the above beliefs. Cheers, Peter For reference, the original parallel-tests-fd-redirect.log: Running from installcheck: no Using TAP: no PATH = /home/peda/automake/tests:/c/Program Files (x86)/Microsoft F#/v4.0/:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VSTSDB/Deploy:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/BIN:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools/:/c/Windows/Microsoft.NET/Framework/v4.0.30319:/c/Windows/Microsoft.NET/Framework/v3.5:/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/VCPackages:/c/Program Files (x86)/HTML Help Workshop:/c/Program Files (x86)/Microsoft Visual Studio 10.0/Team Tools/Performance Tools:/c/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/bin/NETFX 4.0 Tools:.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/ ++ pwd /home/peda/automake/tests/parallel-tests-fd-redirect.dir + cat + cat + aclocal-1.11a -Werror + autoconf -B /no/such/dir + automake-1.11a --foreign -Werror -Wall -a configure.in:2: installing `./test-driver' + cat + chmod a+x foo.sh + cat + chmod a+x foo.sh bar + cat + cat + ./configure checking for a BSD-compatible install... /bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: executing depfiles commands + st=0 + grep '^bar\.log:.*bar' Makefile bar.log: bar + grep '^baz\.log:.*baz\$(EXEEXT)' Makefile baz.log: baz$(EXEEXT) + grep '^\.test\$(EXEEXT)\.log:' Makefile .test$(EXEEXT).log: + /bin/grep -E '^(foo|qux)\.log:' Makefile + test 0 -eq 0 + st=0 + make check + cat stdout make baz.exe qux.test.exe make[1]: Entering directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' gcc -DPACKAGE_NAME=\"parallel-tests-fd-redirect\" -DPACKAGE_TARNAME=\"parallel-tests-fd-redirect\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"parallel-tests-fd-redirect\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"parallel-tests-fd-redirect\" -DVERSION=\"1.0\" -I. -g -O2 -MT baz.o -MD -MP -MF .deps/baz.Tpo -c -o baz.o baz.c mv -f .deps/baz.Tpo .deps/baz.Po gcc -g -O2 -o baz.exe baz.o gcc -DPACKAGE_NAME=\"parallel-tests-fd-redirect\" -DPACKAGE_TARNAME=\"parallel-tests-fd-redirect\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"parallel-tests-fd-redirect\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"parallel-tests-fd-redirect\" -DVERSION=\"1.0\" -I. -g -O2 -MT zardoz.o -MD -MP -MF .deps/zardoz.Tpo -c -o zardoz.o zardoz.c mv -f .deps/zardoz.Tpo .deps/zardoz.Po gcc -g -O2 -o qux.test.exe zardoz.o make[1]: Leaving directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' make check-TESTS check-local make[1]: Entering directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' make[2]: Entering directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' foofoofoo PASS: foo.sh barbarbar PASS: bar PASS: baz.exe PASS: qux.test.exe ============================================================================ Testsuite summary for parallel-tests-fd-redirect 1.0 ============================================================================ # TOTAL: 4 # PASS: 4 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[2]: Leaving directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' make[1]: Nothing to be done for `check-local'. make[1]: Leaving directory `/home/peda/automake/tests/parallel-tests-fd-redirect.dir' + cat foo.log + cat bar.log + cat baz.log + cat qux.log + test 0 -eq 0 + grep '^ foofoofoo$' stdout foofoofoo + grep '^ barbarbar$' stdout barbarbar + grep '^ bazbazbaz$' stdout + exit_status=1 + set +e + cd /home/peda/automake/tests + test no = yes + case $am_explicit_skips in + test 1 -eq 0 + keep_testdirs=yes + am_keeping_testdirs + case $keep_testdirs in + return 0 + set +x parallel-tests-fd-redirect: exit 1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 09 14:33:08 2012 Received: (at 10466) by debbugs.gnu.org; 9 Jan 2012 19:33:08 +0000 Received: from localhost ([127.0.0.1]:51307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkKxw-0007mX-1O for submit@debbugs.gnu.org; Mon, 09 Jan 2012 14:33:08 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:55738) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RkKxt-0007m3-NQ for 10466@debbugs.gnu.org; Mon, 09 Jan 2012 14:33:06 -0500 Received: by wibhj6 with SMTP id hj6so3319811wib.3 for <10466@debbugs.gnu.org>; Mon, 09 Jan 2012 11:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=ZZU2UCXk1oz3N5haTxOt9r3HnBbHEUAWLw+En7dDJFw=; b=NJW0qqf/JFSYgVH9+zoXmdy2Nr0BZRgn2t0QyZgct662JULA1WRwa1L6C+wCWzjffT V+unP2W7BB60N5hWVDEVwFKfISlrENjSgrxosUGw8h54zzcXdTkEK+KsLhG9OVchlB8p B2DsGzrgwtxhTPJhOvBwhKbgrXMj83jB3TsCo= Received: by 10.181.12.43 with SMTP id en11mr29939351wid.6.1326137564725; Mon, 09 Jan 2012 11:32:44 -0800 (PST) Received: from [87.4.94.3] (host3-94-dynamic.4-87-r.retail.telecomitalia.it. [87.4.94.3]) by mx.google.com with ESMTPS id ba4sm68791263wib.5.2012.01.09.11.32.43 (version=SSLv3 cipher=OTHER); Mon, 09 Jan 2012 11:32:44 -0800 (PST) Message-ID: <4F0B40DA.8010306@gmail.com> Date: Mon, 09 Jan 2012 20:32:42 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: Peter Rosin Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> In-Reply-To: <4F0ACFA6.40609@lysator.liu.se> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 01/09/2012 12:29 PM, Peter Rosin wrote: > Hi! > > parallel-tests-fd-redirect.test fails on MSYS, and I think > the cause is that the write (9, ...) simply doesn't work for > MinGW programs (baz.exe and qux.test.exe). It works for the > shell scripts (foo.sh and bar) since /bin/sh is an MSYS > program and thus is a lot more POSIXy. But redirecting from > the MinGW world to the MSYS world in this manner is simply > not possible, I think. I think that will only work for > fd 0,1 and 2 (but I'm not 100% sure). > So I guess even something like this would fail: int main (void) { return (system("echo bazbazbaz >&9") == 0); } right? If yes, the solution might be splitting p'arallel-tests-fd-redirect.test' into two tests, and make the one testing the redirection from C skip on MinGW/MSYS. > Also, including unistd.h will not work for non-ANSI systems, > MinGW provides a half-baked unistd.h but MSVC does not. > MSVC has its write() in io.h, but it will probably suffer > from the same problem with a dysfunctional fd 9. > With this diff: > > diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-red > index 73a134e..5728014 100755 > --- a/tests/parallel-tests-fd-redirect.test > +++ b/tests/parallel-tests-fd-redirect.test > @@ -65,20 +65,26 @@ END > chmod a+x foo.sh bar > > cat > baz.c <<'END' > +#include > #include > int main (void) > { > - write (9, " bazbazbaz\n", 11); > - return 0; > + ssize_t res = write (9, " bazbazbaz\n", 11); > + if (res < 0) > + perror("write failed"); > + return res != 11; > } > END > > cat > zardoz.c <<'END' > +#include > #include > int main (void) > { > - write (9, " quxquxqux\n", 11); > - return 0; > + ssize_t res = write (9, " quxquxqux\n", 11); > + if (res < 0) > + perror("write failed"); > + return res != 11; > } > END > BTW, this change might be independently useful in catching other potential unexpected write failures; would you feel like cooking it in a proper patch? > the embedded test suite goes from 4 PASS to 2 PASS / 2 FAIL, > and this in the log files: > > + cat foo.log > + cat bar.log > + cat baz.log > write failed: Bad file descriptor > + cat qux.log > write failed: Bad file descriptor > > supporting the above beliefs. > > Cheers, > Peter > Thanks, Stefano From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 13 07:38:42 2012 Received: (at 10466) by debbugs.gnu.org; 13 Jan 2012 12:38:42 +0000 Received: from localhost ([127.0.0.1]:55949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlgP3-0000iH-Cf for submit@debbugs.gnu.org; Fri, 13 Jan 2012 07:38:41 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:64568) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RlgP1-0000i9-KS for 10466@debbugs.gnu.org; Fri, 13 Jan 2012 07:38:40 -0500 Received: by wibhj6 with SMTP id hj6so366502wib.3 for <10466@debbugs.gnu.org>; Fri, 13 Jan 2012 04:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=KjUkDDR/F+J/9lJKXpqunZMKfPtowKiSv5Kclw63a9s=; b=DZVsxqM/rxNWoq8rd7N8CakH63CfLhqTSe9DIxYa16oXslfyQTEUQz3aR1cnb2dL4l j3Q24klH7OqEHdrr9Hkb+lp8ssjkNmtEm7oJ+jgW8GZMOkonsZCWVuZfCjoGePjcAoTM EAb+jL9Pb2Ph/b+GlCDfykIqHVFBiT2k0RfjU= Received: by 10.180.94.97 with SMTP id db1mr1418389wib.16.1326458281692; Fri, 13 Jan 2012 04:38:01 -0800 (PST) Received: from [82.56.38.186] (host186-38-dynamic.56-82-r.retail.telecomitalia.it. [82.56.38.186]) by mx.google.com with ESMTPS id k33sm10927081wbo.5.2012.01.13.04.38.00 (version=SSLv3 cipher=OTHER); Fri, 13 Jan 2012 04:38:01 -0800 (PST) Message-ID: <4F1025A7.5020506@gmail.com> Date: Fri, 13 Jan 2012 13:37:59 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: Peter Rosin Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> In-Reply-To: <4F0B40DA.8010306@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Reference: Hi Peter. Ping on this? It seems my reply has somehow slipped through the cracks ... Thanks, Stefano From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 06:41:16 2012 Received: (at 10466) by debbugs.gnu.org; 16 Jan 2012 11:41:16 +0000 Received: from localhost ([127.0.0.1]:59241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rmkw7-0003MK-6f for submit@debbugs.gnu.org; Mon, 16 Jan 2012 06:41:15 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:36519) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rmkw2-0003M5-2L for 10466@debbugs.gnu.org; Mon, 16 Jan 2012 06:41:13 -0500 Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 426A440005; Mon, 16 Jan 2012 12:40:14 +0100 (CET) Received: from [192.168.0.150] (h57n3fls301o1095.telia.com [81.230.178.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id E6B6540002; Mon, 16 Jan 2012 12:40:13 +0100 (CET) Message-ID: <4F140C9E.50907@lysator.liu.se> Date: Mon, 16 Jan 2012 12:40:14 +0100 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Stefano Lattarini Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> In-Reply-To: <4F0B40DA.8010306@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Sorry for the delay. Stefano Lattarini skrev 2012-01-09 20:32: > On 01/09/2012 12:29 PM, Peter Rosin wrote: >> Hi! >> >> parallel-tests-fd-redirect.test fails on MSYS, and I think >> the cause is that the write (9, ...) simply doesn't work for >> MinGW programs (baz.exe and qux.test.exe). It works for the >> shell scripts (foo.sh and bar) since /bin/sh is an MSYS >> program and thus is a lot more POSIXy. But redirecting from >> the MinGW world to the MSYS world in this manner is simply >> not possible, I think. I think that will only work for >> fd 0,1 and 2 (but I'm not 100% sure). >> > So I guess even something like this would fail: > > int main (void) > { > return (system("echo bazbazbaz >&9") == 0); > } > > right? Yes, system() fails as well: + cat foo.log + cat bar.log + cat baz.log The handle could not be duplicated during redirection of handle 1. + cat qux.log The handle could not be duplicated during redirection of handle 1. In a MinGW program, system() invokes the Windows command interpreter (cmd) and not /bin/sh, and it suffers the same redirection troubles as the original C code. However, I think fd 9 is lost already when the MinGW program is fork()/exec()ed from the MSYS environment and adding system() to the mix simply added another non-MSYS layer. I believe anything you try to do, short of being an MSYS program, is going to fail. Since the whole point of MSYS in its normal mode is building MinGW programs with the MinGW compiler (and not MSYS programs), this redirection just won't work. This is one of the costs of the trickery MSYS is guilty of by masquerading as MinGW, when the reality is that the environment is a cross from MSYS to MinGW, and not MinGW native. In a plain old cross enviroment, nobody is surprised when executing generated executables fail in spectacular ways... > If yes, the solution might be splitting p'arallel-tests-fd-redirect.test' > into two tests, and make the one testing the redirection from C skip on MinGW/MSYS. Maybe, but XFAIL would be better if that can be specified for an individual system (I don't think so, but I forget). Also, mentioning it in the documentation would be nice if there is any previous mention of the use of fd 9 from test cases (I'm ignorant here, and haven't bothered to check). >> Also, including unistd.h will not work for non-ANSI systems, >> MinGW provides a half-baked unistd.h but MSVC does not. >> MSVC has its write() in io.h, but it will probably suffer >> from the same problem with a dysfunctional fd 9. > >> With this diff: >> >> diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-red >> index 73a134e..5728014 100755 >> --- a/tests/parallel-tests-fd-redirect.test >> +++ b/tests/parallel-tests-fd-redirect.test >> @@ -65,20 +65,26 @@ END >> chmod a+x foo.sh bar >> >> cat > baz.c <<'END' >> +#include >> #include >> int main (void) >> { >> - write (9, " bazbazbaz\n", 11); >> - return 0; >> + ssize_t res = write (9, " bazbazbaz\n", 11); >> + if (res < 0) >> + perror("write failed"); >> + return res != 11; >> } >> END >> >> cat > zardoz.c <<'END' >> +#include >> #include >> int main (void) >> { >> - write (9, " quxquxqux\n", 11); >> - return 0; >> + ssize_t res = write (9, " quxquxqux\n", 11); >> + if (res < 0) >> + perror("write failed"); >> + return res != 11; >> } >> END >> > BTW, this change might be independently useful in catching other potential > unexpected write failures; would you feel like cooking it in a proper patch? I'm swamped with work for a week or so, go right ahead if you like to and can't wait. Cheers, Peter From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 23 03:48:37 2012 Received: (at 10466) by debbugs.gnu.org; 23 Jan 2012 08:48:37 +0000 Received: from localhost ([127.0.0.1]:40489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpFZs-0007Qc-HE for submit@debbugs.gnu.org; Mon, 23 Jan 2012 03:48:37 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:48152) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpFZp-0007QS-FF for 10466@debbugs.gnu.org; Mon, 23 Jan 2012 03:48:35 -0500 Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 8D41240006; Mon, 23 Jan 2012 09:48:18 +0100 (CET) Received: from [192.168.0.150] (h57n3fls301o1095.telia.com [81.230.178.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 3D0D540003; Mon, 23 Jan 2012 09:48:18 +0100 (CET) Message-ID: <4F1D1ECF.7090608@lysator.liu.se> Date: Mon, 23 Jan 2012 09:48:15 +0100 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Stefano Lattarini Subject: [PATCH] tests: improve diagnostics when write(2) fails (was: bug#10466: MSYS problem with redirects) References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> In-Reply-To: <4F0B40DA.8010306@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefano Lattarini skrev 2012-01-09 20:32: > On 01/09/2012 12:29 PM, Peter Rosin wrote: >> With this diff: >> >> diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-red >> index 73a134e..5728014 100755 >> --- a/tests/parallel-tests-fd-redirect.test >> +++ b/tests/parallel-tests-fd-redirect.test >> @@ -65,20 +65,26 @@ END >> chmod a+x foo.sh bar >> >> cat > baz.c <<'END' >> +#include >> #include >> int main (void) >> { >> - write (9, " bazbazbaz\n", 11); >> - return 0; >> + ssize_t res = write (9, " bazbazbaz\n", 11); >> + if (res < 0) >> + perror("write failed"); >> + return res != 11; >> } >> END >> >> cat > zardoz.c <<'END' >> +#include >> #include >> int main (void) >> { >> - write (9, " quxquxqux\n", 11); >> - return 0; >> + ssize_t res = write (9, " quxquxqux\n", 11); >> + if (res < 0) >> + perror("write failed"); >> + return res != 11; >> } >> END >> > BTW, this change might be independently useful in catching other potential > unexpected write failures; would you feel like cooking it in a proper patch? Like this (for master)? Cheers, Peter >From a8265beb4490e9188358d6e761da33ae326aff41 Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Mon, 23 Jan 2012 09:18:46 +0100 Subject: [PATCH] tests: improve diagnostics when write(2) fails MinGW programs can't redirect file descriptor 9, they can only redirect stdin, stdout and stderr. So, improve the information in the test log. See automake bug#10466. * tests/parallel-tests-fd-redirect.test (baz.c, zardoz.c): Check the return value from the write(2) call, and report detected errors. --- tests/parallel-tests-fd-redirect.test | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-redirect.test index 73a134e..8b16378 100755 --- a/tests/parallel-tests-fd-redirect.test +++ b/tests/parallel-tests-fd-redirect.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,20 +65,26 @@ END chmod a+x foo.sh bar cat > baz.c <<'END' +#include #include int main (void) { - write (9, " bazbazbaz\n", 11); - return 0; + ssize_t res = write (9, " bazbazbaz\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END cat > zardoz.c <<'END' +#include #include int main (void) { - write (9, " quxquxqux\n", 11); - return 0; + ssize_t res = write (9, " quxquxqux\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; } END -- 1.7.5.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 23 04:05:09 2012 Received: (at 10466) by debbugs.gnu.org; 23 Jan 2012 09:05:09 +0000 Received: from localhost ([127.0.0.1]:40493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpFpt-0007nK-HH for submit@debbugs.gnu.org; Mon, 23 Jan 2012 04:05:09 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:53426) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpFpo-0007mm-IZ for 10466@debbugs.gnu.org; Mon, 23 Jan 2012 04:05:08 -0500 Received: by wibhn9 with SMTP id hn9so1803042wib.3 for <10466@debbugs.gnu.org>; Mon, 23 Jan 2012 01:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=UpopV0EBtAsVWHn+e2h4ankA3xwCBJ9d582XfCFeqEo=; b=f4DYVGmJJ2UEJ/DrVJpBuQpe3J+DyKUH8Q74AFNYMmyL4WGOiyJ3t7jTQklueAz9WT Ld1soYE5TCvZPickosuLHsxgbrgwqR1uPx5RASz50RdqFliMulQq/1ln3AbHiu74bKlt +/Fu2WYwqHemBM3HtjQOSwSB2QvXcferFsNJQ= Received: by 10.180.83.104 with SMTP id p8mr12794974wiy.4.1327309485403; Mon, 23 Jan 2012 01:04:45 -0800 (PST) Received: from [87.4.94.72] (host72-94-dynamic.4-87-r.retail.telecomitalia.it. [87.4.94.72]) by mx.google.com with ESMTPS id bu13sm38897356wib.6.2012.01.23.01.04.44 (version=SSLv3 cipher=OTHER); Mon, 23 Jan 2012 01:04:44 -0800 (PST) Message-ID: <4F1D22AB.1060409@gmail.com> Date: Mon, 23 Jan 2012 10:04:43 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: Peter Rosin Subject: Re: [PATCH] tests: improve diagnostics when write(2) fails References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> <4F1D1ECF.7090608@lysator.liu.se> In-Reply-To: <4F1D1ECF.7090608@lysator.liu.se> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 01/23/2012 09:48 AM, Peter Rosin wrote: > Stefano Lattarini skrev 2012-01-09 20:32: > >> BTW, this change might be independently useful in catching other potential >> unexpected write failures; would you feel like cooking it in a proper patch? > > Like this (for master)? > > [SNIP inlined patch] > Yes, the patch is good. Thanks. I'll try to address the still-pending bug#10466 soonish (in next few days). Thanks again for all the testing, Stefano From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 23 05:07:40 2012 Received: (at 10466) by debbugs.gnu.org; 23 Jan 2012 10:07:40 +0000 Received: from localhost ([127.0.0.1]:40522 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpGoN-0000lx-Ss for submit@debbugs.gnu.org; Mon, 23 Jan 2012 05:07:40 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:51825) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RpGoL-0000lk-4B for 10466@debbugs.gnu.org; Mon, 23 Jan 2012 05:07:38 -0500 Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 75BE040006; Mon, 23 Jan 2012 11:07:16 +0100 (CET) Received: from [192.168.0.150] (h57n3fls301o1095.telia.com [81.230.178.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 136AD40003; Mon, 23 Jan 2012 11:07:16 +0100 (CET) Message-ID: <4F1D3155.7000709@lysator.liu.se> Date: Mon, 23 Jan 2012 11:07:17 +0100 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Stefano Lattarini Subject: Re: bug#10466: [PATCH] tests: improve diagnostics when write(2) fails References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> <4F1D1ECF.7090608@lysator.liu.se> <4F1D22AB.1060409@gmail.com> In-Reply-To: <4F1D22AB.1060409@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefano Lattarini skrev 2012-01-23 10:04: > On 01/23/2012 09:48 AM, Peter Rosin wrote: >> Stefano Lattarini skrev 2012-01-09 20:32: >> >>> BTW, this change might be independently useful in catching other potential >>> unexpected write failures; would you feel like cooking it in a proper patch? >> >> Like this (for master)? >> >> [SNIP inlined patch] >> > Yes, the patch is good. Thanks. Pushed. Cheers, Peter From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 27 07:21:41 2012 Received: (at 10466) by debbugs.gnu.org; 27 Jan 2012 12:21:42 +0000 Received: from localhost ([127.0.0.1]:46298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RqkoG-0007zE-Fy for submit@debbugs.gnu.org; Fri, 27 Jan 2012 07:21:41 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:60932) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RqkoB-0007yp-3i; Fri, 27 Jan 2012 07:21:37 -0500 Received: by wicr5 with SMTP id r5so1150493wic.3 for ; Fri, 27 Jan 2012 04:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; bh=ObAYdZozYmyRCRgNKAKEIETtIwz5Q9pdS1KO1Q8OIu0=; b=A+b0Y/WV1Bkg1nfeF7MPA7+uif9qXd7nSMXaEWfoPf9/X9erygkEgvf8cMFDDpflex k/o5m3a4VhhbcBhHqoeC/We3V40CqxobEwgzzNPZn95OV8vnXwIB0FC7F5sCatq36BkT USRULlCN3yldFevBQv9HJJR+GquzHM8lnPUnc= Received: by 10.180.19.97 with SMTP id d1mr10598046wie.12.1327666851840; Fri, 27 Jan 2012 04:20:51 -0800 (PST) Received: from [95.244.95.174] (host174-95-dynamic.244-95-r.retail.telecomitalia.it. [95.244.95.174]) by mx.google.com with ESMTPS id bu13sm22616052wib.6.2012.01.27.04.20.50 (version=SSLv3 cipher=OTHER); Fri, 27 Jan 2012 04:20:51 -0800 (PST) Message-ID: <4F2296A1.4060907@gmail.com> Date: Fri, 27 Jan 2012 13:20:49 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: Peter Rosin Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> <4F140C9E.50907@lysator.liu.se> In-Reply-To: <4F140C9E.50907@lysator.liu.se> Content-Type: multipart/mixed; boundary="------------030508090106070903000605" X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) This is a multi-part message in MIME format. --------------030508090106070903000605 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit tags 10466 + patch severity 10466 minor thanks On 01/16/2012 12:40 PM, Peter Rosin wrote: > Sorry for the delay. > Ditto here :-) > Stefano Lattarini skrev 2012-01-09 20:32: >> On 01/09/2012 12:29 PM, Peter Rosin wrote: >>> Hi! >>> >>> parallel-tests-fd-redirect.test fails on MSYS, and I think >>> the cause is that the write (9, ...) simply doesn't work for >>> MinGW programs (baz.exe and qux.test.exe). It works for the >>> shell scripts (foo.sh and bar) since /bin/sh is an MSYS >>> program and thus is a lot more POSIXy. But redirecting from >>> the MinGW world to the MSYS world in this manner is simply >>> not possible, I think. I think that will only work for >>> fd 0,1 and 2 (but I'm not 100% sure). >>> The attached patch should take care of the issue. Can you confirm this is actually the case, before I push it? Thanks, Stefano --------------030508090106070903000605 Content-Type: text/x-diff; name="0001-tests-work-around-MinGW-MSYS-issue-in-fd-redirection.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-tests-work-around-MinGW-MSYS-issue-in-fd-redirection.pa"; filename*1="tch" >From 53339f86ceb32ff98b1ccfb05539645cb7e641fe Mon Sep 17 00:00:00 2001 Message-Id: <53339f86ceb32ff98b1ccfb05539645cb7e641fe.1327666763.git.stefano.lattarini@gmail.com> From: Stefano Lattarini Date: Tue, 10 Jan 2012 20:27:08 +0100 Subject: [PATCH] tests: work around MinGW/MSYS issue in fd redirections Some checks on $(AM_TESTS_FD_REDIRECT) were failing on MSYS, likely because system calls like "write(9, ...)" simply doesn't work for MinGW-compiled programs. Similar usages work for the shell scripts though, since /bin/sh is an MSYS program and thus is a lot more POSIX-ish than most MinGW-compiled programs. The best fix for this issue is to separate the checks using shell scripts as dummy test cases from the checks using compiled programs for the same purpose, and skip these latter checks on MinGW. This change fixes automake bug#10466. Report by Peter Rosin. * tests/parallel-tests-fd-redirect.test: Move checks using compiled C programs as test cases to ... * tests/parallel-tests-fd-redirect-exeext.test: ... this new test. * tests/list-of-tests.mk: Update. --- tests/list-of-tests.mk | 1 + tests/parallel-tests-fd-redirect-exeext.test | 114 ++++++++++++++++++++++++++ tests/parallel-tests-fd-redirect.test | 59 ++------------ 3 files changed, 122 insertions(+), 52 deletions(-) create mode 100755 tests/parallel-tests-fd-redirect-exeext.test diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk index 31d70a7..8bc0ef0 100644 --- a/tests/list-of-tests.mk +++ b/tests/list-of-tests.mk @@ -702,6 +702,7 @@ parallel-tests-log-compiler-2.test \ parallel-tests-dry-run-1.test \ parallel-tests-dry-run-2.test \ parallel-tests-fd-redirect.test \ +parallel-tests-fd-redirect-exeext.test \ parallel-tests-extra-programs.test \ parallel-tests-unreadable.test \ parallel-tests-subdir.test \ diff --git a/tests/parallel-tests-fd-redirect-exeext.test b/tests/parallel-tests-fd-redirect-exeext.test new file mode 100755 index 0000000..0f9d6da --- /dev/null +++ b/tests/parallel-tests-fd-redirect-exeext.test @@ -0,0 +1,114 @@ +#! /bin/sh +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# parallel-tests support: redirection of file descriptors with +# AM_TESTS_FD_REDIRECT, for tests which are binary executables +# We use some tricks to ensure that all code paths in `lib/am/check2.am' +# are covered, even on platforms where $(EXEEXT) would be naturally empty. +# See also the more generic test 'check-fd-redirect.test', and +# sister test 'parallel-tests-fd-redirect.test'. + +required='cc native' +am_parallel_tests=yes +. ./defs || Exit 1 + +cat >> configure.in << 'END' +AC_PROG_CC +# Calls like "write(9, ...)" are unlikely to work for MinGW-compiled +# programs. We must skip this test if this is the case. +am__ok=no +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[write (9, "foobar\n", 7); return 0;]])], + [AM_RUN_LOG([./conftest$EXEEXT 9>&1]) \ + && AM_RUN_LOG([(./conftest$EXEEXT 9>&1) | grep "^foobar"]) \ + && am__ok=yes]) +test $am__ok = yes || AS_EXIT([63]) +AM_CONDITIONAL([real_EXEEXT], [test -n "$EXEEXT"]) +test -n "$EXEEXT" || EXEEXT=.bin +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AM_TESTS_FD_REDIRECT = 9>&1 +TESTS = $(check_PROGRAMS) +check_PROGRAMS = baz qux.test +qux_test_SOURCES = zardoz.c + +## Sanity check. +if !real_EXEEXT +check-local: + test -f baz.bin + test -f qux.test.bin +endif +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +cat > baz.c <<'END' +#include +#include +int main (void) +{ + ssize_t res = write (9, " bazbazbaz\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; +} +END + +cat > zardoz.c <<'END' +#include +#include +int main (void) +{ + ssize_t res = write (9, " quxquxqux\n", 11); + if (res < 0) + perror("write failed"); + return res != 11; +} +END + +st=0; ./configure || st=$? +cat config.log # For debugging, as we do tricky checks in configure. +if test $st -eq 63; then + skip_ "fd redirect in compiled program unsupported" +elif test $st -eq 0; then + : Continue. +else + fatal_ "unexpected error in ./configure" +fi + +# Sanity checks. +st=0 +grep '^baz\.log:.*baz\$(EXEEXT)' Makefile || st=1 +grep '^\.test\$(EXEEXT)\.log:' Makefile || st=1 +grep '^qux\.log:' Makefile && st=1 +test $st -eq 0 || fatal_ "doesn't cover expected code paths" + +st=0 +$MAKE check >stdout || st=1 +cat stdout +cat baz.log +cat qux.log +test $st -eq 0 +grep "^ bazbazbaz$" stdout +grep "^ quxquxqux$" stdout +$EGREP '(bazbazbaz|quxquxqux)' *.log && Exit 1 + +: diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-redirect.test index 8b16378..f22b31a 100755 --- a/tests/parallel-tests-fd-redirect.test +++ b/tests/parallel-tests-fd-redirect.test @@ -15,36 +15,22 @@ # along with this program. If not, see . # parallel-tests support: redirection of file descriptors with -# AM_TESTS_FD_REDIRECT, even when using tests without suffix, or -# which are binary executables. -# We use some tricks to ensure that all code paths in `lib/am/check2.am' -# are covered, even on platforms where $(EXEEXT) would be naturally empty. +# AM_TESTS_FD_REDIRECT, even when using tests without suffix. +# The sister `parallel-tests-fd-redirect-exeext.test' do a similar +# check for tests that are binary executables. # See also the more generic test 'check-fd-redirect.test'. -required='cc native' am_parallel_tests=yes . ./defs || Exit 1 cat >> configure.in << 'END' -AC_PROG_CC -AM_CONDITIONAL([real_EXEEXT], [test -n "$EXEEXT"]) -test -n "$EXEEXT" || EXEEXT=.bin AC_OUTPUT END cat > Makefile.am << 'END' AM_TESTS_FD_REDIRECT = 9>&1 TEST_EXTENSIONS = .test .sh -TESTS = foo.sh bar $(check_PROGRAMS) -check_PROGRAMS = baz qux.test -qux_test_SOURCES = zardoz.c - -## Sanity check. -if !real_EXEEXT -check-local: - test -f baz.bin - test -f qux.test.bin -endif +TESTS = foo.sh bar END $ACLOCAL @@ -64,52 +50,21 @@ END chmod a+x foo.sh bar -cat > baz.c <<'END' -#include -#include -int main (void) -{ - ssize_t res = write (9, " bazbazbaz\n", 11); - if (res < 0) - perror("write failed"); - return res != 11; -} -END - -cat > zardoz.c <<'END' -#include -#include -int main (void) -{ - ssize_t res = write (9, " quxquxqux\n", 11); - if (res < 0) - perror("write failed"); - return res != 11; -} -END - ./configure # Sanity checks. st=0 grep '^bar\.log:.*bar' Makefile || st=1 -grep '^baz\.log:.*baz\$(EXEEXT)' Makefile || st=1 -grep '^\.test\$(EXEEXT)\.log:' Makefile || st=1 -$EGREP '^(foo|qux)\.log:' Makefile && st=1 +grep '^foo\.log:' Makefile && st=1 test $st -eq 0 || fatal_ "doesn't cover expected code paths" -st=0 -$MAKE check >stdout || st=1 +st=0; $MAKE check >stdout || st=1 cat stdout cat foo.log cat bar.log -cat baz.log -cat qux.log test $st -eq 0 grep "^ foofoofoo$" stdout grep "^ barbarbar$" stdout -grep "^ bazbazbaz$" stdout -grep "^ quxquxqux$" stdout -$EGREP '(foofoofoo|barbarbar|bazbazbaz|quxquxqux)' *.log && Exit 1 +$EGREP '(foofoofoo|barbarbar)' *.log && Exit 1 : -- 1.7.7.3 --------------030508090106070903000605-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 27 09:38:27 2012 Received: (at 10466) by debbugs.gnu.org; 27 Jan 2012 14:38:27 +0000 Received: from localhost ([127.0.0.1]:46395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rqmwd-00048N-BW for submit@debbugs.gnu.org; Fri, 27 Jan 2012 09:38:27 -0500 Received: from mail.lysator.liu.se ([130.236.254.3]:54432) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RqmwZ-00048C-IG for 10466@debbugs.gnu.org; Fri, 27 Jan 2012 09:38:25 -0500 Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 6335C40010; Fri, 27 Jan 2012 15:37:42 +0100 (CET) Received: from [192.168.0.150] (h57n3fls301o1095.telia.com [81.230.178.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 0FE1E40002; Fri, 27 Jan 2012 15:37:42 +0100 (CET) Message-ID: <4F22B6BE.4060408@lysator.liu.se> Date: Fri, 27 Jan 2012 15:37:50 +0100 From: Peter Rosin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Stefano Lattarini Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> <4F140C9E.50907@lysator.liu.se> <4F2296A1.4060907@gmail.com> In-Reply-To: <4F2296A1.4060907@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10466 Cc: 10466@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Stefano Lattarini skrev 2012-01-27 13:20: > tags 10466 + patch > severity 10466 minor > thanks > > On 01/16/2012 12:40 PM, Peter Rosin wrote: >> Sorry for the delay. >> > Ditto here :-) > >> Stefano Lattarini skrev 2012-01-09 20:32: >>> On 01/09/2012 12:29 PM, Peter Rosin wrote: >>>> Hi! >>>> >>>> parallel-tests-fd-redirect.test fails on MSYS, and I think >>>> the cause is that the write (9, ...) simply doesn't work for >>>> MinGW programs (baz.exe and qux.test.exe). It works for the >>>> shell scripts (foo.sh and bar) since /bin/sh is an MSYS >>>> program and thus is a lot more POSIXy. But redirecting from >>>> the MinGW world to the MSYS world in this manner is simply >>>> not possible, I think. I think that will only work for >>>> fd 0,1 and 2 (but I'm not 100% sure). >>>> > The attached patch should take care of the issue. Can you confirm > this is actually the case, before I push it? On Cygwin with gcc, both tests PASS. Good. On MSYS(in MinGW mode) with gcc, ...-exeext SKIPs, because of this: configure:3327: cc -o conftest.exe -g -O2 conftest.c >&5 configure:3327: $? = 0 configure:3328: ./conftest.exe 9>&1 configure:3331: $? = 0 configure:3333: (./conftest.exe 9>&1) | grep ^foobar configure:3336: $? = 1 Good. On MSYS/cl, ...-exeext SKIPs, because of this: configure:3327: /c/Cygwin/home/peda/automake-1.11.2b/lib/compile cl -nologo -o conftest.exe conftest.c >&5 conftest.c conftest.c(11) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory configure:3327: $? = 2 Probably not intended, but perhaps a good thing, because unistd.h will not be available everywhere and lacking it is not should not cause a FAIL in the Automake test suite. So, the patch is good. Thanks for fixing! Cheers, Peter From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 27 11:08:59 2012 Received: (at 10466-done) by debbugs.gnu.org; 27 Jan 2012 16:08:59 +0000 Received: from localhost ([127.0.0.1]:46927 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RqoME-0006Ii-H3 for submit@debbugs.gnu.org; Fri, 27 Jan 2012 11:08:59 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:50709) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RqoMC-0006IW-OT for 10466-done@debbugs.gnu.org; Fri, 27 Jan 2012 11:08:57 -0500 Received: by wicr5 with SMTP id r5so1339923wic.3 for <10466-done@debbugs.gnu.org>; Fri, 27 Jan 2012 08:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=XcVVha+isSmOdy9/RaS7XtyB3VJCbgPFuwtGB+weljY=; b=jN5GSGTWyjBf1KLxC4F2QC4759M5marQoFwO+/bdRo9amu5ok/VcxS0y+490ahiQGt tGXOVkO0Xdz/5YyJakhfvbqVNYxBJiMS7VDNgxy3g2F7YQFZuzmqLa2zRb3vT+CrEJMZ 7TOxY9M/YL00idbU+9o7/xtjTz0vc14kqGgpo= Received: by 10.180.83.104 with SMTP id p8mr12730799wiy.4.1327680492552; Fri, 27 Jan 2012 08:08:12 -0800 (PST) Received: from [95.244.94.3] (host3-94-dynamic.244-95-r.retail.telecomitalia.it. [95.244.94.3]) by mx.google.com with ESMTPS id l6sm12724342wiv.11.2012.01.27.08.08.11 (version=SSLv3 cipher=OTHER); Fri, 27 Jan 2012 08:08:11 -0800 (PST) Message-ID: <4F22CBE2.9000507@gmail.com> Date: Fri, 27 Jan 2012 17:08:02 +0100 From: Stefano Lattarini MIME-Version: 1.0 To: Peter Rosin Subject: Re: bug#10466: MSYS problem with redirects References: <4F0ACFA6.40609@lysator.liu.se> <4F0B40DA.8010306@gmail.com> <4F140C9E.50907@lysator.liu.se> <4F2296A1.4060907@gmail.com> <4F22B6BE.4060408@lysator.liu.se> In-Reply-To: <4F22B6BE.4060408@lysator.liu.se> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 10466-done Cc: 10466-done@debbugs.gnu.org, automake-patches@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 01/27/2012 03:37 PM, Peter Rosin wrote: > > So, the patch is good. Thanks for fixing! > Thanks for confirming. I've pushed the patch, and I'm thus closing this report. Regards, Stefano From unknown Fri Aug 15 20:52:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 25 Feb 2012 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator