bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] test-lchown.h: "symlink ownership not supported" is indicate


From: Bruno Haible
Subject: Re: [PATCH] test-lchown.h: "symlink ownership not supported" is indicated by EOPNOTSUPP
Date: Thu, 20 Dec 2018 03:17:31 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-139-generic; KDE/5.18.0; x86_64; ; )

Hi Ivan,

> Such convention concerning the meaning of EOPNOTSUPP was also stated
> in The Open Group Base Specifications Issue 6
> IEEE Std 1003.1, 2004 Edition
> (http://pubs.opengroup.org/onlinepubs/009604599/functions/lchown.html);
> however, the EOPNOTSUPP case is removed in Issue 7, 2018 Edition
> (http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html).

The fact that it has been removed from the later revision of the standard
means that implementations have now more freedom regarding the errno
value that they return in this case.

> And if ENOSYS is raised for a
> symlink, but not for a directory, this would be against the expected
> behavior and should make the test fail.

You claim "should", but I don't want to make the test fail when it earlier
succeeded; and you have not tested this on the various platforms. As
pointed out above, various errno values should be acceptable.

I've pushed this instead:


2018-12-19  Bruno Haible  <address@hidden>

        lchown tests: Be more permissive regarding errno values.
        Reported by Ivan Zakharyaschev <address@hidden>.
        * tests/test-lchown.h (test_lchown): Recognize EOPNOTSUPP as an
        alternative to ENOSYS.
        * modules/lchown-tests (Depends-on): Add 'errno'.
        * modules/fchownat-tests (Depends-on): Likewise.

diff --git a/modules/fchownat-tests b/modules/fchownat-tests
index 81adf7f..e5fb783 100644
--- a/modules/fchownat-tests
+++ b/modules/fchownat-tests
@@ -7,6 +7,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+errno
 ignore-value
 intprops
 mgetgroups
diff --git a/modules/lchown-tests b/modules/lchown-tests
index c5bba89..42b9460 100644
--- a/modules/lchown-tests
+++ b/modules/lchown-tests
@@ -6,6 +6,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+errno
 ignore-value
 intprops
 mgetgroups
diff --git a/tests/test-lchown.h b/tests/test-lchown.h
index bc10a50..8bf79b1 100644
--- a/tests/test-lchown.h
+++ b/tests/test-lchown.h
@@ -124,7 +124,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool 
print)
       return 77;
     }
   result = func (BASE "dir/link2", -1, -1);
-  if (result == -1 && errno == ENOSYS)
+  if (result == -1 && (errno == ENOSYS || errno == EOPNOTSUPP))
     {
       ASSERT (unlink (BASE "dir/file") == 0);
       ASSERT (unlink (BASE "dir/link2") == 0);




reply via email to

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