emacs-diffs
[Top][All Lists]
Advanced

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

master 27436451ec: Update from Gnulib by running admin/merge-gnulib


From: Paul Eggert
Subject: master 27436451ec: Update from Gnulib by running admin/merge-gnulib
Date: Wed, 6 Jul 2022 01:00:26 -0400 (EDT)

branch: master
commit 27436451ecbf250db4d1704c586763cb40e6dfeb
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Update from Gnulib by running admin/merge-gnulib
    
    * admin/merge-gnulib (AVOIDED_MODULES): Add chmod.
---
 admin/merge-gnulib     |  2 +-
 build-aux/config.guess |  9 ++++--
 build-aux/config.sub   |  6 ++--
 doc/misc/texinfo.tex   |  2 +-
 lib/fchmodat.c         | 59 ++++++++++++-----------------------
 lib/filevercmp.c       | 18 ++++++-----
 lib/filevercmp.h       |  4 ++-
 lib/gnulib.mk.in       |  6 ++++
 lib/lchmod.c           | 84 ++++++++++++++++++++------------------------------
 lib/mini-gmp.h         |  2 +-
 lib/str-two-way.h      |  4 +--
 lib/string.in.h        | 16 +++++++---
 lib/sys_stat.in.h      | 28 ++++++++++++++++-
 m4/fchmodat.m4         |  4 +--
 m4/lchmod.m4           |  6 ++--
 m4/sys_stat_h.m4       |  6 ++--
 16 files changed, 135 insertions(+), 121 deletions(-)

diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index ea3d23686f..4dd6a4d222 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -51,7 +51,7 @@ GNULIB_MODULES='
 '
 
 AVOIDED_MODULES='
-  btowc close crypto/af_alg dup fchdir fstat langinfo lock
+  btowc chmod close crypto/af_alg dup fchdir fstat langinfo lock
   mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo
   openat-die opendir pthread-h raise
   save-cwd select setenv sigprocmask stat stdarg stdbool
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 160ecf0951..1817bdce90 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2022-05-08'
+timestamp='2022-05-25'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1378,8 +1378,11 @@ EOF
     BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
        GUESS=i586-pc-haiku
        ;;
-    x86_64:Haiku:*:*)
-       GUESS=x86_64-unknown-haiku
+    ppc:Haiku:*:*)     # Haiku running on Apple PowerPC
+       GUESS=powerpc-apple-haiku
+       ;;
+    *:Haiku:*:*)       # Haiku modern gcc (not bound by BeOS compat)
+       GUESS=$UNAME_MACHINE-unknown-haiku
        ;;
     SX-4:SUPER-UX:*:*)
        GUESS=sx4-nec-superux$UNAME_RELEASE
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 9b62e37c43..dba16e84c7 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2021 Free Software Foundation, Inc.
+#   Copyright 1992-2022 Free Software Foundation, Inc.
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2021-12-25'
+timestamp='2022-01-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2021 Free Software Foundation, Inc.
+Copyright 1992-2022 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index aa16f51aa4..8872e5e055 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -7651,7 +7651,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 % If SUBTOPIC is present, precede it with a space, and call \doind.
 % (At some time during the 20th century, this made a two-level entry in an
 % index such as the operation index.  Nobody seemed to notice the change in
-% behavior though.)
+% behaviour though.)
 \def\dosubind#1#2#3{%
   \def\thirdarg{#3}%
   \ifx\thirdarg\empty
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index dc53583366..164e2c4a95 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -83,9 +83,10 @@ fchmodat (int dir, char const *file, mode_t mode, int flags)
 # if NEED_FCHMODAT_NONSYMLINK_FIX
   if (flags == AT_SYMLINK_NOFOLLOW)
     {
-      struct stat st;
+#  if HAVE_READLINKAT
+      char readlink_buf[1];
 
-#  if defined O_PATH && defined AT_EMPTY_PATH
+#   ifdef O_PATH
       /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
          follow symbolic links, if /proc is mounted.  O_PATH is used to
          avoid a failure if the file is not readable.
@@ -94,49 +95,29 @@ fchmodat (int dir, char const *file, mode_t mode, int flags)
       if (fd < 0)
         return fd;
 
-      /* Up to Linux 5.3 at least, when FILE refers to a symbolic link, the
-         chmod call below will change the permissions of the symbolic link
-         - which is undesired - and on many file systems (ext4, btrfs, jfs,
-         xfs, ..., but not reiserfs) fail with error EOPNOTSUPP - which is
-         misleading.  Therefore test for a symbolic link explicitly.
-         Use fstatat because fstat does not work on O_PATH descriptors
-         before Linux 3.6.  */
-      if (fstatat (fd, "", &st, AT_EMPTY_PATH) != 0)
+      int err;
+      if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
+        err = EOPNOTSUPP;
+      else if (errno == EINVAL)
         {
-          int stat_errno = errno;
-          close (fd);
-          errno = stat_errno;
-          return -1;
-        }
-      if (S_ISLNK (st.st_mode))
-        {
-          close (fd);
-          errno = EOPNOTSUPP;
-          return -1;
+          static char const fmt[] = "/proc/self/fd/%d";
+          char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
+          sprintf (buf, fmt, fd);
+          err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
         }
+      else
+        err = errno == ENOENT ? -1 : errno;
 
-#   if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
-      static char const fmt[] = "/proc/self/fd/%d";
-      char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
-      sprintf (buf, fmt, fd);
-      int chmod_result = chmod (buf, mode);
-      int chmod_errno = errno;
       close (fd);
-      if (chmod_result == 0)
-        return chmod_result;
-      if (chmod_errno != ENOENT)
-        {
-          errno = chmod_errno;
-          return chmod_result;
-        }
+
+      errno = err;
+      if (0 <= err)
+        return err == 0 ? 0 : -1;
 #   endif
-      /* /proc is not mounted or would not work as in GNU/Linux.  */
 
-#  else
-      int fstatat_result = fstatat (dir, file, &st, AT_SYMLINK_NOFOLLOW);
-      if (fstatat_result != 0)
-        return fstatat_result;
-      if (S_ISLNK (st.st_mode))
+      /* O_PATH + /proc is not supported.  */
+
+      if (0 <= readlinkat (dir, file, readlink_buf, sizeof readlink_buf))
         {
           errno = EOPNOTSUPP;
           return -1;
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index d546e79054..7e54793e61 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -29,6 +29,8 @@
 /* Return the length of a prefix of S that corresponds to the suffix
    defined by this extended regular expression in the C locale:
      (\.[A-Za-z~][A-Za-z0-9~]*)*$
+   Use the longest suffix matching this regular expression,
+   except do not use all of S as a suffix if S is nonempty.
    If *LEN is -1, S is a string; set *LEN to S's length.
    Otherwise, *LEN should be nonnegative, S is a char array,
    and *LEN does not change.  */
@@ -36,20 +38,22 @@ static idx_t
 file_prefixlen (char const *s, ptrdiff_t *len)
 {
   size_t n = *len;  /* SIZE_MAX if N == -1.  */
+  idx_t prefixlen = 0;
 
-  for (idx_t i = 0; ; i++)
+  for (idx_t i = 0; ; )
     {
-      idx_t prefixlen = i;
-      while (i + 1 < n && s[i] == '.' && (c_isalpha (s[i + 1])
-                                          || s[i + 1] == '~'))
-        for (i += 2; i < n && (c_isalnum (s[i]) || s[i] == '~'); i++)
-          continue;
-
       if (*len < 0 ? !s[i] : i == n)
         {
           *len = i;
           return prefixlen;
         }
+
+      i++;
+      prefixlen = i;
+      while (i + 1 < n && s[i] == '.' && (c_isalpha (s[i + 1])
+                                          || s[i + 1] == '~'))
+        for (i += 2; i < n && (c_isalnum (s[i]) || s[i] == '~'); i++)
+          continue;
     }
 }
 
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 5a33677671..57949760b2 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -61,7 +61,9 @@
    without them, using version sort without special priority;
    if they do not compare equal, this comparison result is used and
    the suffixes are effectively ignored.  Otherwise, the entire
-   strings are compared using version sort.
+   strings are compared using version sort.  When removing a suffix
+   from a nonempty string, remove the maximal-length suffix such that
+   the remaining string is nonempty.
 
    This function is intended to be a replacement for strverscmp.  */
 int filevercmp (char const *a, char const *b) _GL_ATTRIBUTE_PURE;
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index bf0df878a5..2ffe89d423 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -35,6 +35,7 @@
 #  --macro-prefix=gl \
 #  --no-vc-files \
 #  --avoid=btowc \
+#  --avoid=chmod \
 #  --avoid=close \
 #  --avoid=crypto/af_alg \
 #  --avoid=dup \
@@ -327,6 +328,7 @@ GL_GNULIB_CALLOC_GNU = @GL_GNULIB_CALLOC_GNU@
 GL_GNULIB_CALLOC_POSIX = @GL_GNULIB_CALLOC_POSIX@
 GL_GNULIB_CANONICALIZE_FILE_NAME = @GL_GNULIB_CANONICALIZE_FILE_NAME@
 GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@
+GL_GNULIB_CHMOD = @GL_GNULIB_CHMOD@
 GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@
 GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@
 GL_GNULIB_CLOSEDIR = @GL_GNULIB_CLOSEDIR@
@@ -1029,6 +1031,7 @@ REPLACE_ALIGNED_ALLOC = @REPLACE_ALIGNED_ALLOC@
 REPLACE_CALLOC_FOR_CALLOC_GNU = @REPLACE_CALLOC_FOR_CALLOC_GNU@
 REPLACE_CALLOC_FOR_CALLOC_POSIX = @REPLACE_CALLOC_FOR_CALLOC_POSIX@
 REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
+REPLACE_CHMOD = @REPLACE_CHMOD@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_CLOSE = @REPLACE_CLOSE@
 REPLACE_CLOSEDIR = @REPLACE_CLOSEDIR@
@@ -1196,6 +1199,7 @@ SETTINGS_LIBS = @SETTINGS_LIBS@
 SHELL = @SHELL@
 SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
 SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+SMALL_JA_DIC = @SMALL_JA_DIC@
 SQLITE3_LIBS = @SQLITE3_LIBS@
 STDALIGN_H = @STDALIGN_H@
 STDDEF_H = @STDDEF_H@
@@ -3497,6 +3501,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNU
              -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
              -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
              -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \
+             -e 's/@''GNULIB_CHMOD''@/$(GL_GNULIB_CHMOD)/g' \
              -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \
              -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \
              -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \
@@ -3528,6 +3533,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNU
              -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \
              -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \
              -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \
+             -e 's|@''REPLACE_CHMOD''@|$(REPLACE_CHMOD)|g' \
              -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \
              -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \
              -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \
diff --git a/lib/lchmod.c b/lib/lchmod.c
index 706dddff7b..8410a2d835 100644
--- a/lib/lchmod.c
+++ b/lib/lchmod.c
@@ -25,17 +25,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
-#ifdef __osf__
-/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
-   eliminates this include because of the preliminary #include <sys/stat.h>
-   above.  */
-# include "sys/stat.h"
-#else
-# include <sys/stat.h>
-#endif
-
 #include <intprops.h>
 
 /* Work like chmod, except when FILE is a symbolic link.
@@ -45,7 +37,9 @@
 int
 lchmod (char const *file, mode_t mode)
 {
-#if defined O_PATH && defined AT_EMPTY_PATH
+  char readlink_buf[1];
+
+#ifdef O_PATH
   /* Open a file descriptor with O_NOFOLLOW, to make sure we don't
      follow symbolic links, if /proc is mounted.  O_PATH is used to
      avoid a failure if the file is not readable.
@@ -54,56 +48,46 @@ lchmod (char const *file, mode_t mode)
   if (fd < 0)
     return fd;
 
-  /* Up to Linux 5.3 at least, when FILE refers to a symbolic link, the
-     chmod call below will change the permissions of the symbolic link
-     - which is undesired - and on many file systems (ext4, btrfs, jfs,
-     xfs, ..., but not reiserfs) fail with error EOPNOTSUPP - which is
-     misleading.  Therefore test for a symbolic link explicitly.
-     Use fstatat because fstat does not work on O_PATH descriptors
-     before Linux 3.6.  */
-  struct stat st;
-  if (fstatat (fd, "", &st, AT_EMPTY_PATH) != 0)
+  int err;
+  if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf))
+    err = EOPNOTSUPP;
+  else if (errno == EINVAL)
     {
-      int stat_errno = errno;
-      close (fd);
-      errno = stat_errno;
-      return -1;
-    }
-  if (S_ISLNK (st.st_mode))
-    {
-      close (fd);
-      errno = EOPNOTSUPP;
-      return -1;
+      static char const fmt[] = "/proc/self/fd/%d";
+      char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
+      sprintf (buf, fmt, fd);
+      err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno;
     }
+  else
+    err = errno == ENOENT ? -1 : errno;
 
-# if defined __linux__ || defined __ANDROID__ || defined __CYGWIN__
-  static char const fmt[] = "/proc/self/fd/%d";
-  char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)];
-  sprintf (buf, fmt, fd);
-  int chmod_result = chmod (buf, mode);
-  int chmod_errno = errno;
   close (fd);
-  if (chmod_result == 0)
-    return chmod_result;
-  if (chmod_errno != ENOENT)
+
+  errno = err;
+  if (0 <= err)
+    return err == 0 ? 0 : -1;
+#endif
+
+  size_t len = strlen (file);
+  if (len && file[len - 1] == '/')
     {
-      errno = chmod_errno;
-      return chmod_result;
+      struct stat st;
+      if (lstat (file, &st) < 0)
+        return -1;
+      if (!S_ISDIR (st.st_mode))
+        {
+          errno = ENOTDIR;
+          return -1;
+        }
     }
-# endif
-  /* /proc is not mounted or would not work as in GNU/Linux.  */
-
-#elif HAVE_LSTAT
-  struct stat st;
-  int lstat_result = lstat (file, &st);
-  if (lstat_result != 0)
-    return lstat_result;
-  if (S_ISLNK (st.st_mode))
+
+  /* O_PATH + /proc is not supported.  */
+
+  if (0 <= readlink (file, readlink_buf, sizeof readlink_buf))
     {
       errno = EOPNOTSUPP;
       return -1;
     }
-#endif
 
   /* Fall back on chmod, despite a possible race.  */
   return chmod (file, mode);
diff --git a/lib/mini-gmp.h b/lib/mini-gmp.h
index 508712d235..59c24cf511 100644
--- a/lib/mini-gmp.h
+++ b/lib/mini-gmp.h
@@ -8,7 +8,7 @@ The GNU MP Library is free software; you can redistribute it 
and/or modify
 it under the terms of either:
 
   * the GNU Lesser General Public License as published by the Free
-    Software Foundation, either version 3 of the License, or (at your
+    Software Foundation; either version 3 of the License, or (at your
     option) any later version.
 
 or
diff --git a/lib/str-two-way.h b/lib/str-two-way.h
index 7ee344aea1..b00017c0b4 100644
--- a/lib/str-two-way.h
+++ b/lib/str-two-way.h
@@ -231,7 +231,7 @@ critical_factorization (const unsigned char *needle, size_t 
needle_len,
    most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
    If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
    HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.  */
-static RETURN_TYPE
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
 two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
                       const unsigned char *needle, size_t needle_len)
 {
@@ -325,7 +325,7 @@ two_way_short_needle (const unsigned char *haystack, size_t 
haystack_len,
    If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
    HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
    sublinear performance is not possible.  */
-static RETURN_TYPE
+static RETURN_TYPE _GL_ATTRIBUTE_PURE
 two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
                      const unsigned char *needle, size_t needle_len)
 {
diff --git a/lib/string.in.h b/lib/string.in.h
index 33160b2525..3996da9fcb 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -122,8 +122,12 @@ _GL_EXTERN_C void rpl_free (void *);
 #  undef _GL_ATTRIBUTE_DEALLOC_FREE
 #  define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
 # else
-#  if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+#  if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 #  else
 #   if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();
@@ -133,8 +137,12 @@ _GL_EXTERN_C void free (void *);
 #  endif
 # endif
 #else
-# if defined _MSC_VER
-_GL_EXTERN_C void __cdecl free (void *);
+# if defined _MSC_VER && !defined free
+_GL_EXTERN_C
+#   if defined _DLL
+     __declspec (dllimport)
+#   endif
+     void __cdecl free (void *);
 # else
 #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
 _GL_EXTERN_C void free (void *) throw ();
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 28ddd42f81..714c3cb189 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -391,7 +391,33 @@ struct stat
 #endif
 
 
-#if @GNULIB_MDA_CHMOD@
+#if @GNULIB_CHMOD@
+# if @REPLACE_CHMOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chmod
+#   define chmod rpl_chmod
+#  endif
+_GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
+# elif defined _WIN32 && !defined __CYGWIN__
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chmod
+#   define chmod _chmod
+#  endif
+/* Need to cast, because in mingw the last argument is 'int mode'.  */
+_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
+# endif
+_GL_CXXALIASWARN (chmod);
+#elif defined GNULIB_POSIXCHECK
+# undef chmod
+# if HAVE_RAW_DECL_CHMOD
+_GL_WARN_ON_USE (chmod, "chmod has portability problems - "
+                 "use gnulib module chmod for portability");
+# endif
+#elif @GNULIB_MDA_CHMOD@
 /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    platforms by defining GNULIB_NAMESPACE::chmod always.  */
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
index a5cf95a88b..f743ce1b02 100644
--- a/m4/fchmodat.m4
+++ b/m4/fchmodat.m4
@@ -1,4 +1,4 @@
-# fchmodat.m4 serial 6
+# fchmodat.m4 serial 7
 dnl Copyright (C) 2004-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -97,6 +97,6 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
 # Prerequisites of lib/fchmodat.c.
 AC_DEFUN([gl_PREREQ_FCHMODAT],
 [
-  AC_CHECK_FUNCS_ONCE([lchmod])
+  AC_CHECK_FUNCS_ONCE([readlinkat])
   :
 ])
diff --git a/m4/lchmod.m4 b/m4/lchmod.m4
index 5baee738ef..cd43beed85 100644
--- a/m4/lchmod.m4
+++ b/m4/lchmod.m4
@@ -1,4 +1,4 @@
-#serial 8
+#serial 10
 
 dnl Copyright (C) 2005-2006, 2008-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
@@ -15,9 +15,7 @@ AC_DEFUN([gl_FUNC_LCHMOD],
   dnl Persuade glibc <sys/stat.h> to declare lchmod().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
-  AC_CHECK_FUNCS_ONCE([lchmod lstat])
+  AC_CHECK_FUNCS_ONCE([lchmod])
   if test "$ac_cv_func_lchmod" = no; then
     HAVE_LCHMOD=0
   fi
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index b5a9789b81..2adbfdeef4 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,4 +1,4 @@
-# sys_stat_h.m4 serial 41   -*- Autoconf -*-
+# sys_stat_h.m4 serial 42   -*- Autoconf -*-
 dnl Copyright (C) 2006-2022 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -46,7 +46,7 @@ AC_DEFUN_ONCE([gl_SYS_STAT_H],
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
-    ]], [fchmodat fstat fstatat futimens getumask lchmod lstat
+    ]], [chmod fchmodat fstat fstatat futimens getumask lchmod lstat
     mkdirat mkfifo mkfifoat mknod mknodat stat utimensat])
 
   AC_REQUIRE([AC_C_RESTRICT])
@@ -72,6 +72,7 @@ AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS],
 [
   m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [
     gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHMOD])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT])
@@ -112,6 +113,7 @@ AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
   HAVE_MKNOD=1;         AC_SUBST([HAVE_MKNOD])
   HAVE_MKNODAT=1;       AC_SUBST([HAVE_MKNODAT])
   HAVE_UTIMENSAT=1;     AC_SUBST([HAVE_UTIMENSAT])
+  REPLACE_CHMOD=0;      AC_SUBST([REPLACE_CHMOD])
   REPLACE_FCHMODAT=0;   AC_SUBST([REPLACE_FCHMODAT])
   REPLACE_FSTAT=0;      AC_SUBST([REPLACE_FSTAT])
   REPLACE_FSTATAT=0;    AC_SUBST([REPLACE_FSTATAT])



reply via email to

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