On Thu, 2019-05-02 at 02:13 -0400, Jeffrey Walton wrote:
> Hi Everyone,
> 
> I'm working from the 4.2.1 tarball. I see __alloca has caused some
> grief. (
> https://lists.gnu.org/archive/html/bug-make/2017-11/msg00020.html
> 
> and friends).
> 
> There have been no GNU Make releases since June 2016. The problem is
> still present, and it does not look like it is going to be fixed
> anytime soon.
> 
> What is the official patch to fix the problem? Does someone have a
> 'diff -u' or a 'git diff'?

Applying the attached patch to a downloaded source tarball of GNU make
4.2.1 should allow it to work correctly with the latest GNU libc
versions.

Note the info at the top of the patch: if you're building from a
tarball you need to "touch" a few files to ensure that it doesn't try
to rebuild autotools files.

Apply this patch to the results of unpacking a make 4.2.1 tarball,
then run the following commands:

    touch aclocal.m4
    touch Makefile.in
    touch configure

Now you should be able to reconfigure and rebuild.



--- a/configure.ac	2016-06-06 08:27:31.000000000 -0400
+++ b/configure.ac	2019-05-04 14:24:17.102496612 -0400
@@ -399,10 +399,9 @@
 #include <glob.h>
 #include <fnmatch.h>
 
-#define GLOB_INTERFACE_VERSION 1
 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
 # include <gnu-versions.h>
-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
+# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
    gnu glob
 # endif
 #endif],
--- a/dir.c	2016-05-31 03:17:26.000000000 -0400
+++ b/dir.c	2019-05-04 14:24:11.134431911 -0400
@@ -407,6 +407,7 @@
     const char *name;           /* Name of the file.  */
     size_t length;
     short impossible;           /* This file is impossible.  */
+    unsigned char type;
   };
 
 static unsigned long
@@ -731,6 +732,9 @@
 #else
           df->name = strcache_add_len (d->d_name, len);
 #endif
+#ifdef _DIRENT_HAVE_D_TYPE
+          df->type = d->d_type;
+#endif
           df->length = len;
           df->impossible = 0;
           hash_insert_at (&dir->dirfiles, df, dirfile_slot);
@@ -1242,7 +1246,7 @@
           d->d_namlen = len - 1;
 #endif
 #ifdef _DIRENT_HAVE_D_TYPE
-          d->d_type = DT_UNKNOWN;
+          d->d_type = df->type;
 #endif
           memcpy (d->d_name, df->name, len);
           return d;
@@ -1299,15 +1303,40 @@
 }
 #endif
 
+/* Similarly for lstat.  */
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
+# ifndef VMS
+#  ifndef HAVE_SYS_STAT_H
+int lstat (const char *path, struct stat *sbuf);
+#  endif
+# else
+    /* We are done with the fake lstat.  Go back to the real lstat */
+#   ifdef lstat
+#     undef lstat
+#   endif
+# endif
+# define local_lstat lstat
+#elif defined(WINDOWS32)
+/* Windows doesn't support lstat().  */
+# define local_lstat local_stat
+#else
+static int
+local_lstat (const char *path, struct stat *buf)
+{
+  int e;
+  EINTRLOOP (e, lstat (path, buf));
+  return e;
+}
+#endif
+
 void
 dir_setup_glob (glob_t *gl)
 {
   gl->gl_opendir = open_dirstream;
   gl->gl_readdir = read_dirstream;
   gl->gl_closedir = free;
+  gl->gl_lstat = local_lstat;
   gl->gl_stat = local_stat;
-  /* We don't bother setting gl_lstat, since glob never calls it.
-     The slot is only there for compatibility with 4.4 BSD.  */
 }
 
 void
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -58,6 +58,9 @@ if ($^O eq 'VMS')
   *CORE::GLOBAL::rmdir = \&vms_rmdir;
 }
 
+use FindBin;
+use lib "$FindBin::Bin";
+
 require "test_driver.pl";
 require "config-flags.pm";
 
--- a/configure	2016-06-10 19:03:21.000000000 -0400
+++ b/configure	2019-05-04 14:33:03.212667798 -0400
@@ -11481,10 +11481,9 @@
 #include <glob.h>
 #include <fnmatch.h>
 
-#define GLOB_INTERFACE_VERSION 1
 #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
 # include <gnu-versions.h>
-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
+# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
    gnu glob
 # endif
 #endif
_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to