]> Savannah Git Hosting - gnulib.git/commitdiff
chown, lchown: Revisit platforms.
authorBruno Haible <bruno@clisp.org>
Sat, 9 Sep 2023 09:26:46 +0000 (11:26 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 9 Sep 2023 09:26:46 +0000 (11:26 +0200)
* doc/posix-functions/chown.texi: Update platforms list.
* doc/posix-functions/lchown.texi: Likewise.
* lib/chown.c (rpl_chown): Add platform comments.
* lib/lchown.c: Likewise.

ChangeLog
doc/posix-functions/chown.texi
doc/posix-functions/lchown.texi
lib/chown.c
lib/lchown.c

index 2aec64130ee6698a0250d539f658e1250a6625da..e2c56220116b1334605a2a48efc06fa2e7523b51 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-09-09  Bruno Haible  <bruno@clisp.org>
+
+       chown, lchown: Revisit platforms.
+       * doc/posix-functions/chown.texi: Update platforms list.
+       * doc/posix-functions/lchown.texi: Likewise.
+       * lib/chown.c (rpl_chown): Add platform comments.
+       * lib/lchown.c: Likewise.
+
 2023-09-07  Paul Eggert  <eggert@cs.ucla.edu>
 
        mbscasecmp: support GNULIB_MCEL_PREFER
index 6a62a6039ff05e969b6c037831d20c43a57f36f9..295ed21504b9c0bb8ed20ab266f9e21a06432b57 100644 (file)
@@ -11,18 +11,20 @@ Portability problems fixed by Gnulib:
 @item
 Some platforms fail to detect trailing slash on non-directories, as in
 @code{chown("link-to-file/",uid,gid)}:
-FreeBSD 7.2, AIX 7.1, Solaris 9.
+macOS 12.5, FreeBSD 7.2, AIX 7.3.1, Solaris 9.
 @item
 Some platforms fail to update the change time when at least one
 argument was not @minus{}1, but no ownership changes resulted:
-OpenBSD 6.7.
+OpenBSD 7.2.
 @item
 When passed an argument of @minus{}1, some implementations really set the owner
 user/group id of the file to this value, rather than leaving that id of the
-file alone.
+file alone:
+some very old platforms.
 @item
 When applied to a symbolic link, some implementations don't dereference
-the symlink, i.e.@: they behave like @code{lchown}.
+the symlink, i.e.@: they behave like @code{lchown}:
+some very old platforms.
 @item
 This function is missing on some platforms; however, the replacement
 always fails with @code{ENOSYS}:
index d9a95b7d234f191b8b53022e163f68204f43c345..74f3abcaeb0f6bbf16454eb0ce1f5442e9066385 100644 (file)
@@ -9,6 +9,14 @@ Gnulib module: lchown
 Portability problems fixed by Gnulib:
 @itemize
 @item
+This function is missing on some platforms; however, the replacement
+fails with @code{ENOSYS}:
+mingw, MSVC 14.
+@item
+This function is missing on some platforms; however, the replacement
+fails on symlinks:
+Minix 3.2.1.
+@item
 Some platforms fail to detect trailing slash on non-directories, as in
 @code{lchown("link-to-file/",uid,gid)}:
 FreeBSD 7.2, Solaris 9.
@@ -17,11 +25,6 @@ Some platforms fail to update the change time when at least one
 argument was not -1, but no ownership changes resulted.  However,
 without @code{lchmod}, the replacement only fixes this for non-symlinks:
 OpenBSD 4.0.
-@item
-This function is missing on some platforms; however, the replacement
-fails on symlinks if @code{chown} is supported, and fails altogether
-with @code{ENOSYS} otherwise:
-Minix 3.1.8, mingw, MSVC 14.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index d735818afdf8774719e4ccb3361cc13bc1c32763..bf15e920b904143b608191e50861316eda3fc6af 100644 (file)
@@ -57,7 +57,7 @@ rpl_chown (const char *file, uid_t uid, gid_t gid)
   bool stat_valid = false;
   int result;
 
-# if CHOWN_CHANGE_TIME_BUG
+# if CHOWN_CHANGE_TIME_BUG /* OpenBSD 7.2 */
   if (gid != (gid_t) -1 || uid != (uid_t) -1)
     {
       if (stat (file, &st))
@@ -66,7 +66,7 @@ rpl_chown (const char *file, uid_t uid, gid_t gid)
     }
 # endif
 
-# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE
+# if CHOWN_FAILS_TO_HONOR_ID_OF_NEGATIVE_ONE /* some very old platforms */
   if (gid == (gid_t) -1 || uid == (uid_t) -1)
     {
       /* Stat file to get id(s) that should remain unchanged.  */
@@ -79,7 +79,7 @@ rpl_chown (const char *file, uid_t uid, gid_t gid)
     }
 # endif
 
-# if CHOWN_MODIFIES_SYMLINK
+# if CHOWN_MODIFIES_SYMLINK /* some very old platforms */
   {
     /* Handle the case in which the system-supplied chown function
        does *not* follow symlinks.  Instead, it changes permissions
@@ -118,7 +118,7 @@ rpl_chown (const char *file, uid_t uid, gid_t gid)
   }
 # endif
 
-# if CHOWN_TRAILING_SLASH_BUG
+# if CHOWN_TRAILING_SLASH_BUG /* macOS 12.5, FreeBSD 7.2, AIX 7.3.1, Solaris 9 */
   if (!stat_valid)
     {
       size_t len = strlen (file);
@@ -129,7 +129,7 @@ rpl_chown (const char *file, uid_t uid, gid_t gid)
 
   result = chown (file, uid, gid);
 
-# if CHOWN_CHANGE_TIME_BUG
+# if CHOWN_CHANGE_TIME_BUG /* OpenBSD 7.2 */
   if (result == 0 && stat_valid
       && (uid == st.st_uid || uid == (uid_t) -1)
       && (gid == st.st_gid || gid == (gid_t) -1))
index 19a68c052bea88ab128202194f0d27e6d9efcf54..d474bc264e164364fe6eb67aed06cb433b5d24d1 100644 (file)
@@ -30,7 +30,7 @@
 
 /* If the system chown does not follow symlinks, we don't want it
    replaced by gnulib's chown, which does follow symlinks.  */
-# if CHOWN_MODIFIES_SYMLINK
+# if CHOWN_MODIFIES_SYMLINK /* native Windows and some very old platforms */
 #  undef chown
 # endif