-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Piotr Tarnowski on 9/28/2007 1:48 AM: >>> This one may already be fixed in CVS. At any rate, could you run 'cd >>> tests; sh -vx ./test-closein.sh' so we can make sure where it is failing? >>> >> Result is in attachement. > > Excuse me, I forgot about attachement ;-) Now it is.
# Test for error when read fails because no file available ./test-closein${EXEEXT} consume <&- 2>/dev/null && exit 1 + ./test-closein consume + exit 1 Bug in the testsuite. According to the Autoconf manual on portabiliby, even though POSIX requires stdin to remain closed across exec if the executable is not setuid (which I sure hope test-closein is not), not all OS's obey this rule. It should be fixed as follows: - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG/PXe84KuGfSFAYARAg6EAKCJ8pVVZLOsjLlO4FkZEM8t3LvPyQCfRdkq HokNKPSzXKMvFqeOMhXhhUA= =1BFc -----END PGP SIGNATURE-----
>From 49adfaf5d36d94624790dc9754a2966a8102d2b3 Mon Sep 17 00:00:00 2001 From: Eric Blake <[EMAIL PROTECTED]> Date: Fri, 28 Sep 2007 06:33:50 -0600 Subject: [PATCH] Fix test-closein on Solaris 10. * tests/test-closein.c (main): Don't assume stdin can be inherited closed on all systems. * tests/test-closein.sh: Likewise. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> --- ChangeLog | 7 +++++++ tests/test-closein.c | 6 +++++- tests/test-closein.sh | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 292c730..ebf8ef3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-28 Eric Blake <[EMAIL PROTECTED]> + + Fix test-closein on Solaris 10. + * tests/test-closein.c (main): Don't assume stdin can be inherited + closed on all systems. + * tests/test-closein.sh: Likewise. + 2007-09-28 Jim Meyering <[EMAIL PROTECTED]> * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Fix typo in comment. diff --git a/tests/test-closein.c b/tests/test-closein.c index 90214e8..cf7b30a 100644 --- a/tests/test-closein.c +++ b/tests/test-closein.c @@ -3,7 +3,7 @@ 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) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -23,6 +23,7 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include "binary-io.h" @@ -43,6 +44,9 @@ main (int argc, char **argv) unreliable on text mode input. */ SET_BINARY (0); + if (argc > 2) + close (0); + if (argc > 1) i = fread (buf, 1, 6, stdin); return 0; diff --git a/tests/test-closein.sh b/tests/test-closein.sh index 8623ead..4f57511 100755 --- a/tests/test-closein.sh +++ b/tests/test-closein.sh @@ -30,7 +30,7 @@ cat ${p}in.tmp | ./test-closein${EXEEXT} consume || exit 1 ./test-closein${EXEEXT} consume </dev/null || exit 1 # Test for error when read fails because no file available -./test-closein${EXEEXT} consume <&- 2>/dev/null && exit 1 +./test-closein${EXEEXT} consume close <&- 2>/dev/null && exit 1 # Cleanup rm -fr $tmpfiles -- 1.5.3.2