* 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-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
@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}:
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.
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:
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))
}
# 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. */
}
# 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
}
# 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);
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))
/* 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