From f0f78bb7362455cab1f482a750fd274a0bf37a3684c7dd897d3cd1f8e8629f86 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 20 Feb 2018 14:46:25 +0000 Subject: [PATCH 1/2] Accepting request 578304 from Virtualization - add use-alloca.patch (bsc#1079838) OBS-URL: https://build.opensuse.org/request/show/578304 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/kbuild?expand=0&rev=36 --- kbuild.changes | 5 ++ kbuild.spec | 4 +- use-alloca.patch | 148 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 use-alloca.patch diff --git a/kbuild.changes b/kbuild.changes index def044e..a3892f2 100644 --- a/kbuild.changes +++ b/kbuild.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Feb 20 10:01:52 UTC 2018 - dmueller@suse.com + +- add use-alloca.patch (bsc#1079838) + ------------------------------------------------------------------- Sun Oct 22 00:43:39 UTC 2017 - Larry.Finger@lwfinger.net diff --git a/kbuild.spec b/kbuild.spec index be13e85..874911e 100644 --- a/kbuild.spec +++ b/kbuild.spec @@ -1,7 +1,7 @@ # # spec file for package kbuild # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -42,6 +42,7 @@ Patch8: kbuild-wrong-memset.patch Patch9: ppc64le.patch Patch10: aarch64.patch Patch11: kbuild-gcc7.patch +Patch12: use-alloca.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -69,6 +70,7 @@ The goals of the kBuild framework: %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 %build export CFLAGS="$RPM_OPT_FLAGS" diff --git a/use-alloca.patch b/use-alloca.patch new file mode 100644 index 0000000..0248194 --- /dev/null +++ b/use-alloca.patch @@ -0,0 +1,148 @@ +--- src/kmk/glob/glob.c.orig 2018-02-20 10:56:04.477559710 +0100 ++++ src/kmk/glob/glob.c 2018-02-20 10:56:51.498370508 +0100 +@@ -209,8 +209,7 @@ + #endif /* __GNU_LIBRARY__ || __DJGPP__ */ + + +-#if !defined __alloca && !defined __GNU_LIBRARY__ +- ++#if !defined alloca + # ifdef __GNUC__ + # undef alloca + # define alloca(n) __builtin_alloca (n) +@@ -227,9 +226,6 @@ + # endif /* Not _AIX. */ + # endif /* sparc or HAVE_ALLOCA_H. */ + # endif /* GCC. */ +- +-# define __alloca alloca +- + #endif + + #ifndef __GNU_LIBRARY__ +@@ -558,7 +554,7 @@ + char *drive_spec; + + ++dirlen; +- drive_spec = (char *) __alloca (dirlen + 1); ++ drive_spec = (char *) alloca (dirlen + 1); + #ifdef HAVE_MEMPCPY + *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0'; + #else +@@ -574,7 +570,7 @@ + from "d:/", since "d:" and "d:/" are not the same.*/ + } + #endif +- newp = (char *) __alloca (dirlen + 1); ++ newp = (char *) alloca (dirlen + 1); + #ifdef HAVE_MEMPCPY + *((char *) mempcpy (newp, pattern, dirlen)) = '\0'; + #else +@@ -645,7 +641,7 @@ + /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try + a moderate value. */ + buflen = 20; +- name = (char *) __alloca (buflen); ++ name = (char *) alloca (buflen); + + success = getlogin_r (name, buflen) >= 0; + # else +@@ -664,7 +660,7 @@ + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. + Try a moderate value. */ + pwbuflen = 1024; +- pwtmpbuf = (char *) __alloca (pwbuflen); ++ pwtmpbuf = (char *) alloca (pwbuflen); + + while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p) + != 0) +@@ -675,7 +671,7 @@ + break; + } + pwbuflen *= 2; +- pwtmpbuf = (char *) __alloca (pwbuflen); ++ pwtmpbuf = (char *) alloca (pwbuflen); + __set_errno (save); + } + # else +@@ -702,7 +698,7 @@ + { + char *newp; + size_t home_len = strlen (home_dir); +- newp = (char *) __alloca (home_len + dirlen); ++ newp = (char *) alloca (home_len + dirlen); + # ifdef HAVE_MEMPCPY + mempcpy (mempcpy (newp, home_dir, home_len), + &dirname[1], dirlen); +@@ -725,7 +721,7 @@ + else + { + char *newp; +- newp = (char *) __alloca (end_name - dirname); ++ newp = (char *) alloca (end_name - dirname); + # ifdef HAVE_MEMPCPY + *((char *) mempcpy (newp, dirname + 1, end_name - dirname)) + = '\0'; +@@ -749,7 +745,7 @@ + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a + moderate value. */ + buflen = 1024; +- pwtmpbuf = (char *) __alloca (buflen); ++ pwtmpbuf = (char *) alloca (buflen); + + while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0) + { +@@ -759,7 +755,7 @@ + break; + } + buflen *= 2; +- pwtmpbuf = __alloca (buflen); ++ pwtmpbuf = alloca (buflen); + __set_errno (save); + } + # else +@@ -776,7 +772,7 @@ + char *newp; + size_t home_len = strlen (home_dir); + size_t rest_len = end_name == NULL ? 0 : strlen (end_name); +- newp = (char *) __alloca (home_len + rest_len + 1); ++ newp = (char *) alloca (home_len + rest_len + 1); + # ifdef HAVE_MEMPCPY + *((char *) mempcpy (mempcpy (newp, home_dir, home_len), + end_name, rest_len)) = '\0'; +@@ -1268,7 +1264,7 @@ + struct stat st; + size_t patlen = strlen (pattern); + size_t dirlen = strlen (directory); +- char *fullname = (char *) __alloca (dirlen + 1 + patlen + 1); ++ char *fullname = (char *) alloca (dirlen + 1 + patlen + 1); + + # ifdef HAVE_MEMPCPY + mempcpy (mempcpy (mempcpy (fullname, directory, dirlen), +@@ -1299,7 +1295,7 @@ + { + /* This is a special case for matching directories like in + "*a/". */ +- names = (struct globlink *) __alloca (sizeof (struct globlink)); ++ names = (struct globlink *) alloca (sizeof (struct globlink)); + names->name = (char *) malloc (1); + if (names->name == NULL) + goto memory_error; +@@ -1358,7 +1354,7 @@ + if (fnmatch (pattern, name, fnm_flags) == 0) + { + struct globlink *new = (struct globlink *) +- __alloca (sizeof (struct globlink)); ++ alloca (sizeof (struct globlink)); + len = NAMLEN (d); + new->name = (char *) malloc (len + 1); + if (new->name == NULL) +@@ -1383,7 +1379,7 @@ + { + size_t len = strlen (pattern); + nfound = 1; +- names = (struct globlink *) __alloca (sizeof (struct globlink)); ++ names = (struct globlink *) alloca (sizeof (struct globlink)); + names->next = NULL; + names->name = (char *) malloc (len + 1); + if (names->name == NULL) From 360c75bec3d089a0f3e40715792f5018ac91600c0f6baa1938789506ffdb426c Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 20 Feb 2018 19:35:36 +0000 Subject: [PATCH 2/2] Accepting request 578428 from home:Andreas_Schwab:Factory - glob-lstat.patch: Do not assume glibc glob internals - glob-interface.patch: Support GLIBC glob interface version 2 OBS-URL: https://build.opensuse.org/request/show/578428 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/kbuild?expand=0&rev=37 --- glob-interface.patch | 16 ++++++++++ glob-lstat.patch | 71 ++++++++++++++++++++++++++++++++++++++++++++ kbuild.changes | 6 ++++ kbuild.spec | 6 +++- 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 glob-interface.patch create mode 100644 glob-lstat.patch diff --git a/glob-interface.patch b/glob-interface.patch new file mode 100644 index 0000000..7ab373a --- /dev/null +++ b/glob-interface.patch @@ -0,0 +1,16 @@ +Index: kbuild-0.1.9998svn3110/src/kmk/configure.in +=================================================================== +--- kbuild-0.1.9998svn3110.orig/src/kmk/configure.in ++++ kbuild-0.1.9998svn3110/src/kmk/configure.in +@@ -360,10 +360,9 @@ AC_CACHE_VAL(make_cv_sys_gnu_glob, [ + #include + #include + +-#define GLOB_INTERFACE_VERSION 1 + #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1 + # include +-# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION ++# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2 + gnu glob + # endif + #endif diff --git a/glob-lstat.patch b/glob-lstat.patch new file mode 100644 index 0000000..0282e72 --- /dev/null +++ b/glob-lstat.patch @@ -0,0 +1,71 @@ +From 193f1e81edd6b1b56b0eb0ff8aa4b41c7b4257b4 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Sun, 24 Sep 2017 09:12:58 -0400 +Subject: [PATCH] glob: Do not assume glibc glob internals. + +It has been proposed that glibc glob start using gl_lstat, +which the API allows it to do. GNU 'make' should not get in +the way of this. See: +https://sourceware.org/ml/libc-alpha/2017-09/msg00409.html + +* dir.c (local_lstat): New function, like local_stat. +(dir_setup_glob): Use it to initialize gl_lstat too, as the API +requires. +--- + dir.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +Index: kbuild-0.1.9998svn3110/src/kmk/dir.c +=================================================================== +--- kbuild-0.1.9998svn3110.orig/src/kmk/dir.c ++++ kbuild-0.1.9998svn3110/src/kmk/dir.c +@@ -1465,6 +1465,32 @@ static int dir_exists_p (const char *dir + } + #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) + { +@@ -1472,15 +1498,11 @@ dir_setup_glob (glob_t *gl) + gl->gl_readdir = read_dirstream; + gl->gl_closedir = ansi_free; + gl->gl_stat = local_stat; +-#ifdef __EMX__ /* The FreeBSD implementation actually uses gl_lstat!! */ +- gl->gl_lstat = local_stat; +-#endif ++ gl->gl_lstat = local_lstat; + #ifdef GLOB_WITH_EXTENDED_KMK_MEMBERS + gl->gl_exists = file_exists_p; + gl->gl_isdir = dir_exists_p; + #endif +- /* We don't bother setting gl_lstat, since glob never calls it. +- The slot is only there for compatibility with 4.4 BSD. */ + } + + void diff --git a/kbuild.changes b/kbuild.changes index a3892f2..31a18f5 100644 --- a/kbuild.changes +++ b/kbuild.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Feb 20 16:26:24 UTC 2018 - schwab@suse.de + +- glob-lstat.patch: Do not assume glibc glob internals +- glob-interface.patch: Support GLIBC glob interface version 2 + ------------------------------------------------------------------- Tue Feb 20 10:01:52 UTC 2018 - dmueller@suse.com diff --git a/kbuild.spec b/kbuild.spec index 874911e..b51234e 100644 --- a/kbuild.spec +++ b/kbuild.spec @@ -25,7 +25,7 @@ BuildRequires: flex BuildRequires: libacl-devel BuildRequires: makeinfo Summary: Framework for writing simple makefiles for complex tasks -License: GPL-2.0+ +License: GPL-2.0-or-later Group: Development/Tools/Building %define _svnrev 3110 Version: 0.1.9998svn%{_svnrev} @@ -43,6 +43,8 @@ Patch9: ppc64le.patch Patch10: aarch64.patch Patch11: kbuild-gcc7.patch Patch12: use-alloca.patch +Patch13: glob-lstat.patch +Patch14: glob-interface.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -71,6 +73,8 @@ The goals of the kBuild framework: %patch10 -p1 %patch11 -p1 %patch12 +%patch13 -p1 +%patch14 -p1 %build export CFLAGS="$RPM_OPT_FLAGS"