From c2174a623d33096b52f4d7fd2963f76acb3e301f Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 19 Apr 2024 00:29:32 -0700 Subject: [PATCH] fstatat, stat: document macOS st_ino pipe bug * doc/posix-functions/fstatat.texi (fstatat): * doc/posix-functions/stat.texi (stat): Document macOS bug (see ). --- ChangeLog | 7 +++++++ doc/posix-functions/fstatat.texi | 5 +++++ doc/posix-functions/stat.texi | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7ce75a98a9..1667f90c55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-04-19 Paul Eggert + + fstatat, stat: document macOS st_ino pipe bug + * doc/posix-functions/fstatat.texi (fstatat): + * doc/posix-functions/stat.texi (stat): + Document macOS bug (see ). + 2024-04-18 Bruno Haible totalordermagl: Add tests. diff --git a/doc/posix-functions/fstatat.texi b/doc/posix-functions/fstatat.texi index e959a5cc73..90884e2eb1 100644 --- a/doc/posix-functions/fstatat.texi +++ b/doc/posix-functions/fstatat.texi @@ -40,5 +40,10 @@ This function does not fail when the second argument is an empty string on some platforms, even when @code{AT_EMPTY_PATH} is not used: glibc 2.7, Linux 2.6.38. @item +This function sets @code{st_ino} only to the low-order 32 bits of +the inode number of a socket or pipe, which thus can disagree +with the @code{st_ino} obtained by @code{fstat}: +macOS 14. +@item @xref{sys/stat.h}, for general portability problems with @code{struct stat}. @end itemize diff --git a/doc/posix-functions/stat.texi b/doc/posix-functions/stat.texi index f655451392..8afd3b17bb 100644 --- a/doc/posix-functions/stat.texi +++ b/doc/posix-functions/stat.texi @@ -50,6 +50,11 @@ Portability problems not fixed by Gnulib: Cygwin's @code{stat} function sometimes sets @code{errno} to @code{EACCES} when @code{ENOENT} would be more appropriate. @item +This function sets @code{st_ino} only to the low-order 32 bits of +the inode number of a socket or pipe, which thus can disagree +with the @code{st_ino} obtained by @code{fstat}: +macOS 14. +@item Because of the definition of @code{struct stat}, it is not possible to portably replace @code{stat} via an object-like macro. Therefore, expressions such as @code{(islnk ? lstat : stat) (name, buf)} are not -- 2.40.1