bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] tests: readlink* ("", ... fails with EINVAL on newer kernels


From: Jim Meyering
Subject: [PATCH] tests: readlink* ("", ... fails with EINVAL on newer kernels
Date: Wed, 30 Mar 2011 08:49:41 +0200

coreutils' "make check" failed on rawhide due to a kernel change
in how readlink and readlinkat treat the empty file name.
Before, they'd fail with ENOENT.  Now, it's EINVAL.
This fixes the tests to accommodate the new errno value:

>From dc44690985e727ac2ef5af783a495a369223ab69 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 30 Mar 2011 08:46:22 +0200
Subject: [PATCH] tests: readlink* ("",... fails with EINVAL on newer kernels

readlink and readlinkat have typically failed with ENOENT for
the invalid, empty file name,  "".  However, with the advent
of linux-2.6.39, they fail with EINVAL.
* tests/test-areadlink.h (test_areadlink): Also accept EINVAL
when operating on the empty file name.
* tests/test-readlink.h (test_readlink): Likewise.
---
 ChangeLog              |   10 ++++++++++
 tests/test-areadlink.h |    2 +-
 tests/test-readlink.h  |    2 +-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9018d90..09a5810 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-03-30  Jim Meyering  <address@hidden>
+
+       tests: readlink* ("",... fails with EINVAL on newer kernels
+       readlink and readlinkat have typically failed with ENOENT for
+       the invalid, empty file name,  "".  However, with the advent
+       of linux-2.6.39, they fail with EINVAL.
+       * tests/test-areadlink.h (test_areadlink): Also accept EINVAL
+       when operating on the empty file name.
+       * tests/test-readlink.h (test_readlink): Likewise.
+
 2011-03-29  Bruno Haible  <address@hidden>

        Relicense some modules under LGPLv2+, for libidn2.
diff --git a/tests/test-areadlink.h b/tests/test-areadlink.h
index c7d8324..55b41c0 100644
--- a/tests/test-areadlink.h
+++ b/tests/test-areadlink.h
@@ -36,7 +36,7 @@ test_areadlink (char * (*func) (char const *, size_t), bool 
print)
   ASSERT (errno == ENOENT);
   errno = 0;
   ASSERT (func ("", 1) == NULL);
-  ASSERT (errno == ENOENT);
+  ASSERT (errno == ENOENT || errno == EINVAL);
   errno = 0;
   ASSERT (func (".", 1) == NULL);
   ASSERT (errno == EINVAL);
diff --git a/tests/test-readlink.h b/tests/test-readlink.h
index 08d5662..7247fc4 100644
--- a/tests/test-readlink.h
+++ b/tests/test-readlink.h
@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, 
size_t), bool print)
   ASSERT (errno == ENOENT);
   errno = 0;
   ASSERT (func ("", buf, sizeof buf) == -1);
-  ASSERT (errno == ENOENT);
+  ASSERT (errno == ENOENT || errno == EINVAL);
   errno = 0;
   ASSERT (func (".", buf, sizeof buf) == -1);
   ASSERT (errno == EINVAL);
--
1.7.4.2.662.gcbd0



reply via email to

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