bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] test-futimens: avoid unwarranted test failure on Solaris 5.11


From: Jim Meyering
Subject: [PATCH] test-futimens: avoid unwarranted test failure on Solaris 5.11
Date: Mon, 11 Oct 2010 12:51:09 +0200

There was one gnulib test failure (via coreutils) on Solaris 5.11:

    FAIL: test-futimens (exit: 262)
    ===============================
    test-futimens.h:81: assertion failed

That's because futimens (AT_FDCWD, NULL) would fail with errno set to
EFAULT, rather than the expected value of EBADF.

At first I was going to relax the test to allow "|| errno == EFAULT",
but what if EFAULT is not defined?  There's only one other use in gnulib.
Besides, since we're expecting EBADF, it makes sense to use a more
precisely targeted test.  Less chance that some other implementation will
interpret things differently.

>From 0afab138f4aedb7eaab70957c164aa0e5eb01fce Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 11 Oct 2010 12:44:56 +0200
Subject: [PATCH] test-futimens: avoid unwarranted test failure on Solaris 5.11

* tests/test-futimens.h (test_futimens): When provoking EBADF, use an
invalid file descriptor, so we don't provoke EFAULT from Solaris 5.11,
because it tries to dereference the NULL name argument.
---
 ChangeLog             |    7 +++++++
 tests/test-futimens.h |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2f0f370..22a22df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-10-11  Jim Meyering  <address@hidden>
+
+       test-futimens: avoid unwarranted test failure on Solaris 5.11
+       * tests/test-futimens.h (test_futimens): When provoking EBADF, use an
+       invalid file descriptor, so we don't provoke EFAULT from Solaris 5.11,
+       because it tries to dereference the NULL name argument.
+
 2010-10-11  Bruno Haible  <address@hidden>

        Indentation.
diff --git a/tests/test-futimens.h b/tests/test-futimens.h
index ab86ae2..a0312b7 100644
--- a/tests/test-futimens.h
+++ b/tests/test-futimens.h
@@ -75,7 +75,7 @@ test_futimens (int (*func) (int, struct timespec const *),

   /* Invalid arguments.  */
   errno = 0;
-  ASSERT (func (AT_FDCWD, NULL) == -1);
+  ASSERT (func (-1, NULL) == -1);
   ASSERT (errno == EBADF);
   {
     struct timespec ts[2] = { { Y2K, UTIME_BOGUS_POS }, { Y2K, 0 } };
--
1.7.3.1.104.gc752e



reply via email to

[Prev in Thread] Current Thread [Next in Thread]