[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: findutils-git: 1 test may fail
From: |
Eric Blake |
Subject: |
Re: findutils-git: 1 test may fail |
Date: |
Thu, 13 Aug 2009 11:18:22 -0700 (PDT) |
> > one test -- test-dup2 -- recently added to the findutils test suite
> > is inherently broken and may fail.
>
> Thanks for the report.
> Rather than removing the test, let's fix it by closing the next
> two fd's. It should be an easy enough fix, but I don't have
> commit access right now or I would do it.
Now that I'm back from vacation, here's what I will be committing:
From: Eric Blake <address@hidden>
Date: Thu, 13 Aug 2009 12:11:47 -0600
Subject: [PATCH] test-dup2: fix bad assumption
* tests/test-dup2.c (main): Tolerate leaked fds from environment.
Reported by Peter Breitenlohner <address@hidden>.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
tests/test-dup2.c | 6 +++++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6fb3750..1e82039 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
2009-08-13 Eric Blake <address@hidden>
+
+ test-dup2: fix bad assumption
+ * tests/test-dup2.c (main): Tolerate leaked fds from environment.
+ Reported by Peter Breitenlohner <address@hidden>.
+
+2009-08-13 Eric Blake <address@hidden>
and Bruno Haible <address@hidden>
stddef: fix NetBSD 5.0 NULL bug, rather than working around it
diff --git a/tests/test-dup2.c b/tests/test-dup2.c
index 67f49ef..2009aaa 100644
--- a/tests/test-dup2.c
+++ b/tests/test-dup2.c
@@ -67,8 +67,12 @@ main ()
char buffer[1];
int fd = open (file, O_CREAT | O_RDWR, 0600);
- ASSERT (0 <= fd);
+ /* Assume std descriptors were provided by invoker. */
+ ASSERT (STDERR_FILENO < fd);
ASSERT (is_open (fd));
+ /* Ignore any other fd's leaked into this process. */
+ close (fd + 1);
+ close (fd + 2);
ASSERT (!is_open (fd + 1));
ASSERT (!is_open (fd + 2));
--
1.6.3.2
--
View this message in context:
http://www.nabble.com/Re%3A-findutils-git%3A-1-test-may-fail-tp24797929p24956214.html
Sent from the Gnulib mailing list archive at Nabble.com.