]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Import gnulib changes
authorTom Tromey <tromey@adacore.com>
Mon, 18 Apr 2022 18:56:41 +0000 (12:56 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 25 Apr 2022 13:29:02 +0000 (07:29 -0600)
This imports the gnulib patches that were mentioned by Eli.  I created
the patches from gnulib git, ran them through filterdiff, and then
applied them using update-gnulib.sh's patch-applying facility.

I think the patches are either obviously Windows-specific or harmless,
but I encourage you to look for yourself.

I tested by rebuilding on x86-64 Fedora 34, and also using the Fedora
mingw cross toolchain.

gnulib/Makefile.in
gnulib/doc/gendocs_template
gnulib/doc/gendocs_template_min
gnulib/import/glob.c
gnulib/import/select.c
gnulib/import/unistd.in.h
gnulib/patches/0002-glob-tilde-check [new file with mode: 0644]
gnulib/patches/0003-unistd-h-fix [new file with mode: 0644]
gnulib/patches/0004-select-mingw [new file with mode: 0644]
gnulib/update-gnulib.sh

index af264c3c12dec02dd3b92072c7be0da7e0c9f87c..a29a9b6ce8847ebfa24041d10e26da2061d136f0 100644 (file)
@@ -14,7 +14,7 @@
 
 @SET_MAKE@
 
-# Copyright (C) 2019-2021 Free Software Foundation, Inc.
+# Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
 # This file is part of GDB.
 
index c8c8fc61001035808a47fd55831424c9e4d54297..cd9ac38319a6d1c4569a87119feef3dd6de5db80 100644 (file)
@@ -2,7 +2,7 @@
 <!-- Parent-Version: 1.78 -->
 
 <!--
-Copyright (C) 2006-2022 Free Software Foundation, Inc.
+Copyright (C) 2006-2021 Free Software Foundation, Inc.
 
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
index 369f494476a4061eb11974738a5c498ebe96cbb2..36e60ff79f99ad42d0258faafb4d073cdd4b4206 100644 (file)
@@ -4,7 +4,7 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 
 <!--
-Copyright (C) 2007-2022 Free Software Foundation, Inc.
+Copyright (C) 2007-2021 Free Software Foundation, Inc.
 
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
index 1bfcafb7b36d0a4fdba289a03eb245e69a82b8dd..6307b1e91e711a79fe9600692171488c7d634636 100644 (file)
@@ -743,6 +743,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
       else
         {
 #ifndef WINDOWS32
+          /* Recognize ~user as a shorthand for the specified user's home
+             directory.  */
           char *end_name = strchr (dirname, '/');
           char *user_name;
           int malloc_user_name = 0;
@@ -881,7 +883,22 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
               }
             scratch_buffer_free (&pwtmpbuf);
           }
-#endif /* !WINDOWS32 */
+#else /* WINDOWS32 */
+          /* On native Windows, access to a user's home directory
+             (via GetUserProfileDirectory) or to a user's environment
+             variables (via ExpandEnvironmentStringsForUser) requires
+             the credentials of the user.  Therefore we cannot support
+             the ~user syntax on this platform.
+             Handling ~user specially (and treat it like plain ~) if
+             user is getenv ("USERNAME") would not be a good idea,
+             since it would make people think that ~user is supported
+             in general.  */
+          if (flags & GLOB_TILDE_CHECK)
+            {
+              retval = GLOB_NOMATCH;
+              goto out;
+            }
+#endif /* WINDOWS32 */
         }
     }
 
index 56ac8bb7b586c5d935a5770caaf4e9ef0f24499f..3a6857d1ccd8a354a3b26913474715bfbabd7159 100644 (file)
@@ -530,12 +530,13 @@ restart:
       if (h != handle_array[nhandles])
         {
           /* Perform handle->descriptor mapping.  */
-          WSAEventSelect ((SOCKET) h, NULL, 0);
-          if (FD_ISSET (h, &handle_rfds))
+          SOCKET s = (SOCKET) h;
+          WSAEventSelect (s, NULL, 0);
+          if (FD_ISSET (s, &handle_rfds))
             FD_SET (i, rfds);
-          if (FD_ISSET (h, &handle_wfds))
+          if (FD_ISSET (s, &handle_wfds))
             FD_SET (i, wfds);
-          if (FD_ISSET (h, &handle_xfds))
+          if (FD_ISSET (s, &handle_xfds))
             FD_SET (i, xfds);
         }
       else
index 5e9b47d981eed9c3aa17ed4d2104ad78e22a487f..460d24866bc6b0bf077c3f80d5fd1ef321feb44c 100644 (file)
@@ -2033,9 +2033,17 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
 #   undef swab
 #   define swab _swab
 #  endif
-_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
-# else
+/* Need to cast, because in old mingw the arguments are
+                             (const char *from, char *to, size_t n).  */
+_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
+# else
+#  if defined __hpux /* HP-UX */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
+#  elif defined __sun && !defined _XPG4 /* Solaris */
+_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
+#  else
 _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
+#  endif
 # endif
 _GL_CXXALIASWARN (swab);
 #endif
diff --git a/gnulib/patches/0002-glob-tilde-check b/gnulib/patches/0002-glob-tilde-check
new file mode 100644 (file)
index 0000000..98bf54e
--- /dev/null
@@ -0,0 +1,49 @@
+commit 38d0749a3077b03fda46567510b1217fb5e4e170
+Author: Bruno Haible <bruno@clisp.org>
+Date:   Fri Apr 2 17:34:46 2021 +0200
+
+    glob: Reject ~user syntax, when flag GLOB_TILDE_CHECK is given.
+    
+    Reported and patch suggested by Eli Zaretskii <eliz@gnu.org> in
+    <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00136.html>.
+    
+    * lib/glob.c (__glob) [WINDOWS32]: If flag GLOB_TILDE_CHECK is given, do
+    error handling like when ~user is allowed by the user is unknown.
+
+diff --git a/gnulib/import/glob.c b/gnulib/import/glob.c
+index 775911ef5b..e148f8d761 100644
+--- a/gnulib/import/glob.c
++++ b/gnulib/import/glob.c
+@@ -743,6 +743,8 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
+       else
+         {
+ #ifndef WINDOWS32
++          /* Recognize ~user as a shorthand for the specified user's home
++             directory.  */
+           char *end_name = strchr (dirname, '/');
+           char *user_name;
+           int malloc_user_name = 0;
+@@ -881,7 +883,22 @@ __glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
+               }
+             scratch_buffer_free (&pwtmpbuf);
+           }
+-#endif /* !WINDOWS32 */
++#else /* WINDOWS32 */
++          /* On native Windows, access to a user's home directory
++             (via GetUserProfileDirectory) or to a user's environment
++             variables (via ExpandEnvironmentStringsForUser) requires
++             the credentials of the user.  Therefore we cannot support
++             the ~user syntax on this platform.
++             Handling ~user specially (and treat it like plain ~) if
++             user is getenv ("USERNAME") would not be a good idea,
++             since it would make people think that ~user is supported
++             in general.  */
++          if (flags & GLOB_TILDE_CHECK)
++            {
++              retval = GLOB_NOMATCH;
++              goto out;
++            }
++#endif /* WINDOWS32 */
+         }
+     }
diff --git a/gnulib/patches/0003-unistd-h-fix b/gnulib/patches/0003-unistd-h-fix
new file mode 100644 (file)
index 0000000..f573872
--- /dev/null
@@ -0,0 +1,36 @@
+commit c7b1e060d17023065c776757da406d728310cc38
+Author: Bruno Haible <bruno@clisp.org>
+Date:   Sun Jun 20 17:18:26 2021 +0200
+
+    unistd: Avoid compilation error in C++ mode on Solaris, HP-UX, mingw.
+    
+    Reported by Eli Zaretskii <eliz@gnu.org> in
+    <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00135.html>.
+    
+    * lib/unistd.in.h (swab): Consider different declarations on Solaris,
+    HP-UX, and old mingw.
+
+diff --git a/gnulib/import/unistd.in.h b/gnulib/import/unistd.in.h
+index d4d4ba7743..73c882f97b 100644
+--- a/gnulib/import/unistd.in.h
++++ b/gnulib/import/unistd.in.h
+@@ -2034,9 +2034,17 @@ _GL_WARN_ON_USE (sleep, "sleep is unportable - "
+ #   undef swab
+ #   define swab _swab
+ #  endif
+-_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n));
+-# else
++/* Need to cast, because in old mingw the arguments are
++                             (const char *from, char *to, size_t n).  */
++_GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
++# else
++#  if defined __hpux /* HP-UX */
++_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
++#  elif defined __sun && !defined _XPG4 /* Solaris */
++_GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
++#  else
+ _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
++#  endif
+ # endif
+ _GL_CXXALIASWARN (swab);
+ #endif
diff --git a/gnulib/patches/0004-select-mingw b/gnulib/patches/0004-select-mingw
new file mode 100644 (file)
index 0000000..912ae4d
--- /dev/null
@@ -0,0 +1,33 @@
+commit 21fccfa0451ba59fba479e439465da9c360353d3
+Author: Paul Eggert <eggert@cs.ucla.edu>
+Date:   Thu Jul 8 10:00:30 2021 -0700
+
+    select: port better to MinGW
+    
+    Problem reported by Eli Zaretskii in:
+    https://lists.gnu.org/r/bug-gnulib/2021-07/msg00017.html
+    * lib/select.c (rpl_select) [_WIN32 && !__CYGWIN__]:
+    Pass a SOCKET, not a HANDLE, to FD_ISSET.
+
+diff --git a/gnulib/import/select.c b/gnulib/import/select.c
+index 2fe6a18064..eddac4b61f 100644
+--- a/gnulib/import/select.c
++++ b/gnulib/import/select.c
+@@ -530,12 +530,13 @@ restart:
+       if (h != handle_array[nhandles])
+         {
+           /* Perform handle->descriptor mapping.  */
+-          WSAEventSelect ((SOCKET) h, NULL, 0);
+-          if (FD_ISSET (h, &handle_rfds))
++          SOCKET s = (SOCKET) h;
++          WSAEventSelect (s, NULL, 0);
++          if (FD_ISSET (s, &handle_rfds))
+             FD_SET (i, rfds);
+-          if (FD_ISSET (h, &handle_wfds))
++          if (FD_ISSET (s, &handle_wfds))
+             FD_SET (i, wfds);
+-          if (FD_ISSET (h, &handle_xfds))
++          if (FD_ISSET (s, &handle_xfds))
+             FD_SET (i, xfds);
+         }
+       else
index e4a910ff6c56098beeb12f0fba82bd0eb1a78ab8..7e8a54410cffe84957550b7cfdfc7b45ca6b0a15 100755 (executable)
@@ -180,6 +180,7 @@ fi
 # Apply our local patches.
 apply_patches ()
 {
+    echo "Applying $1..."
     patch -p2 -f -i "$1"
     if [ $? -ne 0 ]; then
         echo "Failed to apply some patches.  Aborting."
@@ -188,6 +189,9 @@ apply_patches ()
 }
 
 apply_patches "patches/0001-use-windows-stat"
+apply_patches "patches/0002-glob-tilde-check"
+apply_patches "patches/0003-unistd-h-fix"
+apply_patches "patches/0004-select-mingw"
 
 # Regenerate all necessary files...
 aclocal &&