From: Bruno Haible Date: Sun, 19 May 2024 09:55:13 +0000 (+0200) Subject: mkfifoat: Work around a macOS 14 bug. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=472fcf165af97cc9fe54bfc389da17771fc3a3d1;p=gnulib.git mkfifoat: Work around a macOS 14 bug. * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Also test the case of a dangling symlink. * doc/posix-functions/mkfifoat.texi: Mention the macOS bug. --- diff --git a/ChangeLog b/ChangeLog index c09ebb954e..71398561c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-05-18 Bruno Haible + + mkfifoat: Work around a macOS 14 bug. + * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Also test the case of a dangling + symlink. + * doc/posix-functions/mkfifoat.texi: Mention the macOS bug. + 2024-05-18 Collin Funk dup3: Fix behavior for equal file descriptors on NetBSD. diff --git a/doc/posix-functions/mkfifoat.texi b/doc/posix-functions/mkfifoat.texi index 97d04af38d..a811e45b82 100644 --- a/doc/posix-functions/mkfifoat.texi +++ b/doc/posix-functions/mkfifoat.texi @@ -16,6 +16,10 @@ But the replacement function is not safe to be used in libraries and is not mult This function does not fail when the file name argument ends in a slash and (without the slash) names a nonexistent file, on some platforms: AIX 7.2. +@item +This function does not fail when the file name argument ends in a slash +and (without the slash) names a symbolic link, on some platforms: +macOS 14. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/mkfifoat.m4 b/m4/mkfifoat.m4 index 26540506f7..7f685d761b 100644 --- a/m4/mkfifoat.m4 +++ b/m4/mkfifoat.m4 @@ -1,7 +1,7 @@ -# serial 10 +# serial 11 # See if we need to provide mkfifoat/mknodat replacement. -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_MKFIFOAT], gl_CHECK_FUNCS_ANDROID_MACOS([mknodat], [[#include ]]) gl_CHECK_FUNCS_ANDROID_MACOS([mkfifoat], [[#include ]]) if test $ac_cv_func_mkfifoat = yes; then - dnl Check for AIX 7.2 bug with trailing slash. + dnl Check for AIX 7.2 bug and macOS 14 bugs with trailing slash. AC_CACHE_CHECK([whether mkfifoat rejects trailing slashes], [gl_cv_func_mkfifoat_works], [rm -f conftest.tmp @@ -29,10 +29,16 @@ AC_DEFUN([gl_FUNC_MKFIFOAT], [AC_LANG_PROGRAM( [[#include #include + #include ]], [[int result = 0; + /* This test fails on AIX 7.2. */ if (!mkfifoat (AT_FDCWD, "conftest.tmp/", 0600)) result |= 1; + /* This test fails on macOS 14. */ + if (!symlink ("conftest.fifo", "conftest.tmp") + && !mkfifoat (AT_FDCWD, "conftest.tmp/", 0600)) + result |= 2; return result; ]]) ], @@ -43,6 +49,8 @@ AC_DEFUN([gl_FUNC_MKFIFOAT], linux-* | linux) gl_cv_func_mkfifoat_works="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_mkfifoat_works="guessing yes" ;; + # Guess no on macOS systems. + darwin*) gl_cv_func_mkfifoat_works="guessing no" ;; # Guess no on AIX systems. aix*) gl_cv_func_mkfifoat_works="guessing no" ;; # If we don't know, obey --enable-cross-guesses.