diff --git a/ChangeLog b/ChangeLog
index c2cebf1c91e94f8a063fb5e04793d0e78a7c0ade..416d6735232ff8b2c4032cc93a88017571ef38de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,61 @@
+2017-09-25  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       [BZ #22183]
+       * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase
+       version to 2.
+       * posix/Makefile (routines): Add glob-lstat-compat and
+       glob64-lstat-compat.
+       * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version.
+       * posix/glob-lstat-compat.c: New file.
+       * posix/glob64-lstat-compat.c: Likewise.
+       * posix/tst-glob_lstat_compat.c: Likewise.
+       * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise.
+       * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise.
+       * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-32/glob64-lstat-compat.c:
+       Likewise.
+       * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file.
+       * sysdeps/unix/sysv/linux/s390/s390-32/glob64.c: Likewise.
+       * posix/glob.c (glob_lstat): New function.
+       (glob): Rename to __glob and add versioned symbol to 2.27.
+       (glob_in_dir): Use glob_lstat.
+       * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE.
+       * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for
+       2.27.
+       * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise.
+       * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define.
+       * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use
+       gl_lstat on glob call.
+       * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob
+       and glob64 symbols.
+       * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
+       Likewise.
+       * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
+
 2017-09-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure.ac (AS): Require binutils 2.25 or later.
diff --git a/include/gnu-versions.h b/include/gnu-versions.h
index 40f2bfcc799c2125d1ab999ea48ffb99568ee8ae..ce2625440b0705eb8f555baecabf139882df6067 100644 (file)
--- a/include/gnu-versions.h
+++ b/include/gnu-versions.h
@@ -45,7 +45,7 @@
 
 #define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
 #define _GNU_REGEX_INTERFACE_VERSION   1 /* vs posix/regex.c */
-#define _GNU_GLOB_INTERFACE_VERSION    1 /* vs posix/glob.c */
+#define _GNU_GLOB_INTERFACE_VERSION    2 /* vs posix/glob.c */
 #define _GNU_GETOPT_INTERFACE_VERSION  2 /* vs posix/getopt.c and
                                             posix/getopt1.c */
 
diff --git a/posix/Makefile b/posix/Makefile
index 7f77b07dfa4511bc2d62b1af9344bab746a86f87..b5894425ae20b76c31f92154d25efff50268075e 100644 (file)
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -46,6 +46,7 @@ routines :=                                                                 \
        getresuid getresgid setresuid setresgid                               \
        pathconf sysconf fpathconf                                            \
        glob glob64 globfree globfree64 glob_pattern_p fnmatch regex          \
+       glob-lstat-compat glob64-lstat-compat                                 \
        confstr                                                               \
        getopt getopt1                                                        \
        sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax  \
@@ -95,7 +96,8 @@ tests         := test-errno tstgetopt testfnm runtests runptests \
                   tst-posix_fadvise tst-posix_fadvise64 \
                   tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve
 tests-internal := bug-regex5 bug-regex20 bug-regex33 \
-                  tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3
+                  tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \
+                  tst-glob_lstat_compat
 xtests         := bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs      := globtest
diff --git a/posix/Versions b/posix/Versions
index bb481a505b734c0d699a6f3f71b18d40f185ef8e..65e96870e1d065dd30c4528412b4f5079ac7369a 100644 (file)
--- a/posix/Versions
+++ b/posix/Versions
@@ -134,6 +134,9 @@ libc {
   GLIBC_2.11 {
     execvpe;
   }
+  GLIBC_2.27 {
+    glob; glob64;
+  }
   GLIBC_PRIVATE {
     __libc_fork; __libc_pread; __libc_pwrite;
   }
diff --git a/posix/glob-lstat-compat.c b/posix/glob-lstat-compat.c
new file mode 100644 (file)
index 0000000..e30d343
--- /dev/null
+++ b/posix/glob-lstat-compat.c
@@ -0,0 +1,36 @@
+/* Compat glob which does not use gl_lstat for GLOB_ALTDIRFUNC.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_27)
+
+# include <glob.h>
+
+# define __glob(pattern, flags, errfunc, pglob) \
+  __glob_lstat_compat (pattern, flags, errfunc, pglob)
+
+# define GLOB_ATTRIBUTE attribute_compat_text_section
+
+/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
+# define GLOB_NO_LSTAT
+
+# include <posix/glob.c>
+
+compat_symbol (libc, __glob_lstat_compat, glob, GLIBC_2_0);
+#endif
diff --git a/posix/glob.c b/posix/glob.c
index c699177d193de1cd9ea802cf2d6022efec2dd92e..98122dac8821b41824e7bcd4f8ef99711ec1ed0c 100644 (file)
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -57,7 +57,9 @@
 # endif
 # define struct_stat64         struct stat64
 # define FLEXIBLE_ARRAY_MEMBER
+# include <shlib-compat.h>
 #else /* !_LIBC */
+# define __glob                 glob
 # define __getlogin_r(buf, len) getlogin_r (buf, len)
 # define __lstat64(fname, buf)  lstat (fname, buf)
 # define __stat64(fname, buf)   stat (fname, buf)
@@ -179,6 +181,29 @@ convert_dirent64 (const struct dirent64 *source)
     ((void) (buf), (void) (len), (void) (newlen), (void) (avar), (void *) 0)
 #endif
 
+static int
+glob_lstat (glob_t *pglob, int flags, const char *fullname)
+{
+/* Use on glob-lstat-compat.c to provide a compat symbol which does not
+   use lstat / gl_lstat.  */
+#ifdef GLOB_NO_LSTAT
+# define GL_LSTAT gl_stat
+# define LSTAT64 __stat64
+#else
+# define GL_LSTAT gl_lstat
+# define LSTAT64 __lstat64
+#endif
+
+  union
+  {
+    struct stat st;
+    struct_stat64 st64;
+  } ust;
+  return (__glibc_unlikely (flags & GLOB_ALTDIRFUNC)
+          ? pglob->GL_LSTAT (fullname, &ust.st)
+          : LSTAT64 (fullname, &ust.st64));
+}
+
 /* Set *R = A + B.  Return true if the answer is mathematically
    incorrect due to overflow; in this case, *R is the low order
    bits of the correct answer.  */
@@ -248,6 +273,9 @@ next_brace_sub (const char *cp, int flags)
   return *cp != '\0' ? cp : NULL;
 }
 
+#ifndef GLOB_ATTRIBUTE
+# define GLOB_ATTRIBUTE
+#endif
 
 /* Do glob searching for PATTERN, placing results in PGLOB.
    The bits defined above may be set in FLAGS.
@@ -258,11 +286,9 @@ next_brace_sub (const char *cp, int flags)
    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
    Otherwise, 'glob' returns zero.  */
 int
-#ifdef GLOB_ATTRIBUTE
 GLOB_ATTRIBUTE
-#endif
-glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
-      glob_t *pglob)
+__glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
+       glob_t *pglob)
 {
   const char *filename;
   char *dirname = NULL;
@@ -406,9 +432,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
              /* Construct the new glob expression.  */
              mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
 
-             result = glob (onealt,
-                            ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
-                             | GLOB_APPEND), errfunc, pglob);
+             result = __glob (onealt,
+                              ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
+                               | GLOB_APPEND),
+                              errfunc, pglob);
 
              /* If we got an error, return it.  */
              if (result && result != GLOB_NOMATCH)
@@ -557,7 +584,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
                  flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
                }
            }
-         int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
+         int val = __glob (dirname, flags | GLOB_MARK, errfunc, pglob);
          if (val == 0)
            pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
                               | (flags & GLOB_MARK));
@@ -931,11 +958,10 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
          dirs.gl_lstat = pglob->gl_lstat;
        }
 
-      status = glob (dirname,
-                    ((flags & (GLOB_ERR | GLOB_NOESCAPE
-                               | GLOB_ALTDIRFUNC))
-                     | GLOB_NOSORT | GLOB_ONLYDIR),
-                    errfunc, &dirs);
+      status = __glob (dirname,
+                      ((flags & (GLOB_ERR | GLOB_NOESCAPE | GLOB_ALTDIRFUNC))
+                       | GLOB_NOSORT | GLOB_ONLYDIR),
+                      errfunc, &dirs);
       if (status != 0)
        {
          if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH)
@@ -1133,8 +1159,9 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
 
   return retval;
 }
-#if defined _LIBC && !defined glob
-libc_hidden_def (glob)
+#if defined _LIBC && !defined __glob
+versioned_symbol (libc, __glob, glob, GLIBC_2_27);
+libc_hidden_ver (__glob, glob)
 #endif
 
 
@@ -1250,11 +1277,6 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
     }
   else if (meta == GLOBPAT_NONE)
     {
-      union
-      {
-       struct stat st;
-       struct_stat64 st64;
-      } ust;
       size_t patlen = strlen (pattern);
       size_t fullsize;
       bool alloca_fullname
@@ -1273,10 +1295,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
       mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
                        "/", 1),
               pattern, patlen + 1);
-      if (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
-          ? (*pglob->gl_lstat) (fullname, &ust.st)
-           : __lstat64 (fullname, &ust.st64))
-          == 0)
+      if (glob_lstat (pglob, flags, fullname) == 0
          || errno == EOVERFLOW)
        /* We found this file to be existing.  Now tell the rest
           of the function to copy this name into the result.  */
diff --git a/posix/glob64-lstat-compat.c b/posix/glob64-lstat-compat.c
new file mode 100644 (file)
index 0000000..1fabf86
--- /dev/null
+++ b/posix/glob64-lstat-compat.c
@@ -0,0 +1,36 @@
+/* Compat glob which does not use gl_lstat for GLOB_ALTDIRFUNC.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_27)
+
+# include <glob.h>
+
+# define glob(pattern, flags, errfunc, pglob) \
+  __glob64_lstat_compat (pattern, flags, errfunc, pglob)
+
+# define GLOB_ATTRIBUTE attribute_compat_text_section
+
+/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
+# define GLOB_NO_LSTAT
+
+# include <posix/glob64.c>
+
+compat_symbol (libc, __glob64_lstat_compat, glob64, GLIBC_2_0);
+#endif
diff --git a/posix/glob64.c b/posix/glob64.c
index a515a1c12f39d84bd20e48bedc04efee4f5a7ea6..ee7ef841f11fab9a01b2430ac2c268c6a25a3d35 100644 (file)
--- a/posix/glob64.c
+++ b/posix/glob64.c
@@ -20,6 +20,10 @@
 #include <glob.h>
 #include <errno.h>
 
+#ifdef GLOB_ATTRIBUTE
+# define GLOB_ATTRIBUTE
+#endif
+
 /* Do glob searching for PATTERN, placing results in PGLOB.
    The bits defined above may be set in FLAGS.
    If a directory cannot be opened or read and ERRFUNC is not nil,
@@ -29,6 +33,7 @@
    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
    Otherwise, `glob' returns zero.  */
 int
+GLOB_ATTRIBUTE
 glob64 (const char *pattern, int flags,
        int (*errfunc) (const char *, int), glob64_t *pglob)
 {
diff --git a/posix/tst-glob_lstat_compat.c b/posix/tst-glob_lstat_compat.c
new file mode 100644 (file)
index 0000000..ccfda4b
--- /dev/null
+++ b/posix/tst-glob_lstat_compat.c
@@ -0,0 +1,263 @@
+/* Test glob compat symbol which avoid call GLOB_ALTDIRFUNC/gl_lstat.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <glob.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <stdio.h>
+
+#include <shlib-compat.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+
+#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)
+
+__typeof (glob) glob;
+compat_symbol_reference (libc, glob, glob, GLIBC_2_0);
+
+/* Compat glob should not call gl_lstat since for some old binaries it
+   might be unitialized (for instance GNUmake).  Check if it is indeed
+   not called.  */
+static bool stat_called;
+static bool lstat_called;
+
+static struct
+{
+  const char *name;
+  int level;
+  int type;
+} filesystem[] =
+{
+  { ".", 1, DT_DIR },
+  { "..", 1, DT_DIR },
+  { "dir1lev1", 1, DT_UNKNOWN },
+    { ".", 2, DT_DIR },
+    { "..", 2, DT_DIR },
+    { "file1lev2", 2, DT_REG },
+    { "file2lev2", 2, DT_REG },
+};
+static const size_t nfiles = sizeof (filesystem) / sizeof (filesystem [0]);
+
+typedef struct
+{
+  int level;
+  int idx;
+  struct dirent d;
+  char room_for_dirent[NAME_MAX];
+} my_DIR;
+
+static long int
+find_file (const char *s)
+{
+  int level = 1;
+  long int idx = 0;
+
+  while (s[0] == '/')
+    {
+      if (s[1] == '\0')
+       {
+         s = ".";
+         break;
+       }
+      ++s;
+    }
+
+  if (strcmp (s, ".") == 0)
+    return 0;
+
+  if (s[0] == '.' && s[1] == '/')
+    s += 2;
+
+  while (*s != '\0')
+    {
+      char *endp = strchrnul (s, '/');
+
+      while (idx < nfiles && filesystem[idx].level >= level)
+       {
+         if (filesystem[idx].level == level
+             && memcmp (s, filesystem[idx].name, endp - s) == 0
+             && filesystem[idx].name[endp - s] == '\0')
+           break;
+         ++idx;
+       }
+
+      if (idx == nfiles || filesystem[idx].level < level)
+       {
+         errno = ENOENT;
+         return -1;
+       }
+
+      if (*endp == '\0')
+       return idx + 1;
+
+      if (filesystem[idx].type != DT_DIR
+         && (idx + 1 >= nfiles
+             || filesystem[idx].level >= filesystem[idx + 1].level))
+       {
+         errno = ENOTDIR;
+         return -1;
+       }
+
+      ++idx;
+
+      s = endp + 1;
+      ++level;
+    }
+
+  errno = ENOENT;
+  return -1;
+}
+
+static void *
+my_opendir (const char *s)
+{
+  long int idx = find_file (s);
+  if (idx == -1 || filesystem[idx].type != DT_DIR)
+    return NULL;
+
+  my_DIR *dir = malloc (sizeof (my_DIR));
+  if (dir == NULL)
+    FAIL_EXIT1 ("cannot allocate directory handle");
+
+  dir->level = filesystem[idx].level;
+  dir->idx = idx;
+
+  return dir;
+}
+
+static struct dirent *
+my_readdir (void *gdir)
+{
+  my_DIR *dir = gdir;
+
+  if (dir->idx == -1)
+    return NULL;
+
+  while (dir->idx < nfiles && filesystem[dir->idx].level > dir->level)
+    ++dir->idx;
+
+  if (dir->idx == nfiles || filesystem[dir->idx].level < dir->level)
+    {
+      dir->idx = -1;
+      return NULL;
+    }
+
+  dir->d.d_ino = 1;            /* glob should not skip this entry.  */
+
+#ifdef _DIRENT_HAVE_D_TYPE
+  dir->d.d_type = filesystem[dir->idx].type;
+#endif
+
+  strcpy (dir->d.d_name, filesystem[dir->idx].name);
+
+  ++dir->idx;
+
+  return &dir->d;
+}
+
+static void
+my_closedir (void *dir)
+{
+  free (dir);
+}
+
+static int
+my_stat (const char *name, struct stat *st)
+{
+  stat_called = true;
+
+  long int idx = find_file (name);
+  if (idx == -1)
+    return -1;
+
+  memset (st, '\0', sizeof (*st));
+
+  if (filesystem[idx].type == DT_UNKNOWN)
+    st->st_mode = DTTOIF (idx + 1 < nfiles
+                         && filesystem[idx].level < filesystem[idx + 1].level
+                         ? DT_DIR : DT_REG) | 0777;
+  else
+    st->st_mode = DTTOIF (filesystem[idx].type) | 0777;
+  return 0;
+}
+
+static int
+my_lstat (const char *name, struct stat *st)
+{
+  lstat_called = true;
+
+  long int idx = find_file (name);
+  if (idx == -1)
+    return -1;
+
+  memset (st, '\0', sizeof (*st));
+
+  if (filesystem[idx].type == DT_UNKNOWN)
+    st->st_mode = DTTOIF (idx + 1 < nfiles
+                         && filesystem[idx].level < filesystem[idx + 1].level
+                         ? DT_DIR : DT_REG) | 0777;
+  else
+    st->st_mode = DTTOIF (filesystem[idx].type) | 0777;
+  return 0;
+}
+
+static int
+do_test (void)
+{
+  glob_t gl;
+
+  memset (&gl, '\0', sizeof (gl));
+
+  gl.gl_closedir = my_closedir;
+  gl.gl_readdir = my_readdir;
+  gl.gl_opendir = my_opendir;
+  gl.gl_lstat = my_lstat;
+  gl.gl_stat = my_stat;
+
+  int flags = GLOB_ALTDIRFUNC;
+
+  stat_called = false;
+  lstat_called = false;
+
+  TEST_VERIFY_EXIT (glob ("*/file1lev2", flags, NULL, &gl) == 0);
+  TEST_VERIFY_EXIT (gl.gl_pathc == 1);
+  TEST_VERIFY_EXIT (strcmp (gl.gl_pathv[0], "dir1lev1/file1lev2") == 0);
+
+  TEST_VERIFY_EXIT (stat_called == true);
+  TEST_VERIFY_EXIT (lstat_called == false);
+
+  return 0;
+}
+
+#else /* TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_27)  */
+
+static int
+do_test (void)
+{
+  return 77;
+}
+#endif
+
+#include <support/test-driver.c>
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
index 81e4fe9d9c263c416b70b29cb8a530afcb5ecf48..e7438c5c1d8dcf6cbcd45576b4bd7e5d48616f05 100644 (file)
--- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist
@@ -2103,3 +2103,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c b/sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c
new file mode 100644 (file)
index 0000000..a76471d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c
@@ -0,0 +1,2 @@
+#define GLOB_LSTAT_VERSION GLIBC_2_1
+#include <sysdeps/unix/sysv/linux/glob-lstat-compat.c>
diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist
index fab73317ca741bbb521825c7f052bb2a99e084d0..4836ea03745e1a1dc9504cad283b847b6f70e078 100644 (file)
--- a/sysdeps/unix/sysv/linux/alpha/libc.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist
@@ -2014,6 +2014,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/alpha/oldglob.c b/sysdeps/unix/sysv/linux/alpha/oldglob.c
index 988c92ba450e072d23ed28741dfed80e56c1919a..b54624c61149fb6e073224c29055202e655c2fe6 100644 (file)
--- a/sysdeps/unix/sysv/linux/alpha/oldglob.c
+++ b/sysdeps/unix/sysv/linux/alpha/oldglob.c
@@ -59,7 +59,9 @@ __old_glob (const char *pattern, int flags,
   correct.gl_closedir = pglob->gl_closedir;
   correct.gl_readdir = pglob->gl_readdir;
   correct.gl_opendir = pglob->gl_opendir;
-  correct.gl_lstat = pglob->gl_lstat;
+  /* Set gl_lstat and gl_stat for both gl_stat for compatibility with old
+     implementation that did not follow dangling symlinks.  */
+  correct.gl_lstat = pglob->gl_stat;
   correct.gl_stat = pglob->gl_stat;
 
   result = glob (pattern, flags, errfunc, &correct);
@@ -72,7 +74,7 @@ __old_glob (const char *pattern, int flags,
   pglob->gl_closedir = correct.gl_closedir;
   pglob->gl_readdir = correct.gl_readdir;
   pglob->gl_opendir = correct.gl_opendir;
-  pglob->gl_lstat = correct.gl_lstat;
+  /* Only need to restore gl_stat.  */
   pglob->gl_stat = correct.gl_stat;
 
   return result;
diff --git a/sysdeps/unix/sysv/linux/arm/libc.abilist b/sysdeps/unix/sysv/linux/arm/libc.abilist
index d2a206a8dfccbabfc215a4874c9d7d85168b23b2..5b70e1bfc97a569b1f08bc63635e30717b7b4c97 100644 (file)
--- a/sysdeps/unix/sysv/linux/arm/libc.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libc.abilist
@@ -104,6 +104,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
diff --git a/sysdeps/unix/sysv/linux/alpha/glob.c b/sysdeps/unix/sysv/linux/glob-lstat-compat.c
similarity index 50%
rename from sysdeps/unix/sysv/linux/alpha/glob.c
rename to sysdeps/unix/sysv/linux/glob-lstat-compat.c
index 1b813c1cfdb56f7f197b852518a8311ae86b6b1b..9867e2f3b118f4c9d3b34dee3e8a886591a44717 100644 (file)
--- a/sysdeps/unix/sysv/linux/alpha/glob.c
+++ b/sysdeps/unix/sysv/linux/glob-lstat-compat.c
@@ -1,4 +1,6 @@
-/* Copyright (C) 1998-2017 Free Software Foundation, Inc.
+/* Compat glob which does not use gl_lstat for GLOB_ALTDIRFUNC.
+   Linux version which handles LFS when required.
+   Copyright (C) 2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -12,36 +14,34 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
+   License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define glob64 __no_glob64_decl
-#define globfree64 __no_globfree64_decl
-
-#include <sys/types.h>
-#include <glob.h>
+#include <sys/stat.h>
+#include <kernel_stat.h>
 #include <shlib-compat.h>
 
-/* For Linux/Alpha we have to make the glob symbols versioned.  */
-#define glob(pattern, flags, errfunc, pglob) \
-  __new_glob (pattern, flags, errfunc, pglob)
-#define globfree(pglob) \
-  __new_globfree (pglob)
+#define glob64 __no_glob64_decl
+#include <glob.h>
+#undef glob64
 
-/* We need prototypes for these new names.  */
-extern int __new_glob (const char *__pattern, int __flags,
-                      int (*__errfunc) (const char *, int),
-                      glob_t *__pglob);
-extern void __new_globfree (glob_t *__pglob);
+#define __glob __glob_lstat_compat
 
-#include <posix/glob.c>
+#define GLOB_ATTRIBUTE attribute_compat_text_section
 
-#undef glob
-#undef globfree
-#undef glob64
-#undef globfree64
+/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
+#define GLOB_NO_LSTAT
 
-versioned_symbol (libc, __new_glob, glob, GLIBC_2_1);
-libc_hidden_ver (__new_glob, glob)
+#include <posix/glob.c>
 
-weak_alias (__new_glob, glob64)
+#ifndef GLOB_LSTAT_VERSION
+# define GLOB_LSTAT_VERSION GLIBC_2_0
+#endif
+
+#if SHLIB_COMPAT(libc, GLOB_LSTAT_VERSION, GLIBC_2_27)
+compat_symbol (libc, __glob_lstat_compat, glob, GLOB_LSTAT_VERSION);
+# if XSTAT_IS_XSTAT64
+strong_alias (__glob_lstat_compat, __glob64_lstat_compat)
+compat_symbol (libc, __glob64_lstat_compat, glob64, GLOB_LSTAT_VERSION);
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/glob.c b/sysdeps/unix/sysv/linux/glob.c
index 057ae7fe25e8d01f2685c8d3bb16d996e9033681..e3547993abdb5cd632ed2ddd54ee9882d05baa4c 100644 (file)
--- a/sysdeps/unix/sysv/linux/glob.c
+++ b/sysdeps/unix/sysv/linux/glob.c
@@ -20,9 +20,12 @@
 #include <kernel_stat.h>
 
 #define glob64 __no_glob64_decl
+#define __glob64 __no___glob64_decl
 #include <posix/glob.c>
 #undef glob64
+#undef __glob64
 
 #if XSTAT_IS_XSTAT64
-weak_alias (glob, glob64)
+strong_alias (__glob, __glob64)
+versioned_symbol (libc, __glob64, glob64, GLIBC_2_27);
 #endif
diff --git a/sysdeps/unix/sysv/linux/glob64-lstat-compat.c b/sysdeps/unix/sysv/linux/glob64-lstat-compat.c
new file mode 100644 (file)
index 0000000..4f80602
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/glob64-lstat-compat.c
@@ -0,0 +1,56 @@
+/* Compat glob which does not use gl_lstat for GLOB_ALTDIRFUNC.
+   Linux version which handles LFS when required.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <sys/stat.h>
+#include <kernel_stat.h>
+
+#if !XSTAT_IS_XSTAT64
+# include <glob.h>
+# include <dirent.h>
+# include <sys/stat.h>
+# include <shlib-compat.h>
+
+# define dirent dirent64
+# define __readdir(dirp) __readdir64 (dirp)
+
+# define glob_t glob64_t
+# define __glob __glob64_lstat_compat
+# define globfree globfree64
+
+# undef stat
+# define stat stat64
+
+# define COMPILE_GLOB64        1
+
+# define GLOB_ATTRIBUTE attribute_compat_text_section
+
+/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
+# define GLOB_NO_LSTAT
+
+# include <posix/glob.c>
+
+# if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_27)
+#  ifndef GLOB_NO_OLD_VERSION
+#   define GLOB_LSTAT_START_VER GLIBC_2_2
+#  else
+#   define GLOB_LSTAT_START_VER GLIBC_2_1
+#  endif
+compat_symbol (libc, __glob64_lstat_compat, glob64, GLOB_LSTAT_START_VER);
+# endif
+#endif /* XSTAT_IS_XSTAT64  */
diff --git a/sysdeps/unix/sysv/linux/glob64.c b/sysdeps/unix/sysv/linux/glob64.c
index 428bbacb11a117c2067ab1e94cc22fc029f7ef54..0189d1c77d8fc1fec4e86de220d9a0e73d3d602d 100644 (file)
--- a/sysdeps/unix/sysv/linux/glob64.c
+++ b/sysdeps/unix/sysv/linux/glob64.c
@@ -28,8 +28,7 @@
 # define __readdir(dirp) __readdir64 (dirp)
 
 # define glob_t glob64_t
-# define glob(pattern, flags, errfunc, pglob) \
-  __glob64 (pattern, flags, errfunc, pglob)
+# define __glob __glob64
 # define globfree(pglob) globfree64 (pglob)
 
 # undef stat
@@ -39,13 +38,13 @@
 
 # include <posix/glob.c>
 
-# include "shlib-compat.h"
+# include <shlib-compat.h>
 
 # ifdef GLOB_NO_OLD_VERSION
 strong_alias (__glob64, glob64)
 libc_hidden_def (glob64)
 # else
-versioned_symbol (libc, __glob64, glob64, GLIBC_2_2);
+versioned_symbol (libc, __glob64, glob64, GLIBC_2_27);
 libc_hidden_ver (__glob64, glob64)
 # endif
 #endif /* XSTAT_IS_XSTAT64  */
diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist
index 24bb7300d3305f1860e9dde98aa0077fe0d947b5..6a2500a8b3fcd35f76dbcc4956412cdb80705750 100644 (file)
--- a/sysdeps/unix/sysv/linux/hppa/libc.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist
@@ -1868,6 +1868,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist
index 12e77bd7f280de77a51f339328f50313a3ac2d25..9ab4e3642a12e253a4cc3e6037d149020e85d19a 100644 (file)
--- a/sysdeps/unix/sysv/linux/i386/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libc.abilist
@@ -2033,6 +2033,9 @@ GLIBC_2.26 strtof128 F
 GLIBC_2.26 strtof128_l F
 GLIBC_2.26 wcstof128 F
 GLIBC_2.26 wcstof128_l F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/ia64/libc.abilist b/sysdeps/unix/sysv/linux/ia64/libc.abilist
index 62b67b859da852ba5ec1141c5becdcfa68c66d77..81bb623fe8fa2b03174d0b18c83165bc973e9783 100644 (file)
--- a/sysdeps/unix/sysv/linux/ia64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libc.abilist
@@ -1897,6 +1897,9 @@ GLIBC_2.26 strtof128 F
 GLIBC_2.26 strtof128_l F
 GLIBC_2.26 wcstof128 F
 GLIBC_2.26 wcstof128_l F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
index b594ebd7c67bc20c29b84add0ef8557b511249a7..5a33b57390e7c26e0ce6a0da3d3cf9b671e1d536 100644 (file)
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
@@ -105,6 +105,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.4 GLIBC_2.4 A
 GLIBC_2.4 _Exit F
 GLIBC_2.4 _IO_2_1_stderr_ D 0x98
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
index a36739d41c197fbf13c1b6349c7b268d68e1f9f6..50a86e74fa2d59274c8b6bde26755aeb7c46a015 100644 (file)
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
@@ -1982,6 +1982,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
index 16aa25485f62d0d600aa5a039e1f81eb4cfa160a..250ef305c3277646b6bfc0f9f3689e5d3472753e 100644 (file)
--- a/sysdeps/unix/sysv/linux/microblaze/libc.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libc.abilist
@@ -2103,3 +2103,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
index 907ab331f2e40c958972d3ee9b3637690f58dde5..87a1dc4ad7b0a77694dc09215d5faeffcf339908 100644 (file)
--- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
@@ -1957,6 +1957,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
index 36ee235d7110999c47a1ad564d42b44492c8f8b5..f2b35f250ec83a61c449d21a09c2a9f19d9a58a8 100644 (file)
--- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
@@ -1955,6 +1955,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
index 783aa73ab7ddcd9a28461863f1a2f03a601e0900..e119842b47fb0a5c6a46977be55cc4750d9e6eaa 100644 (file)
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
@@ -1953,6 +1953,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
index e1275dfe28d86aa139eff4d0628aaedeef6c194c..67f10f5641e60df17022e7e09d1676d07690f121 100644 (file)
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
@@ -1948,6 +1948,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/nios2/libc.abilist b/sysdeps/unix/sysv/linux/nios2/libc.abilist
index be252287d19fc762ef11ed03032888d218843f41..c599dd921235b62baa101d5b607f0f6ad8d743e7 100644 (file)
--- a/sysdeps/unix/sysv/linux/nios2/libc.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libc.abilist
@@ -2144,3 +2144,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/oldglob.c b/sysdeps/unix/sysv/linux/oldglob.c
index 5402450f5579db4081fba37a02ada23903cd869e..a034c2d930751c261da81b462b736e4d667dda42 100644 (file)
--- a/sysdeps/unix/sysv/linux/oldglob.c
+++ b/sysdeps/unix/sysv/linux/oldglob.c
@@ -21,7 +21,7 @@ libc_hidden_proto (__old_glob64);
 #define __readdir(dirp) __old_readdir64 (dirp)
 
 #define glob_t glob64_t
-#define glob(pattern, flags, errfunc, pglob) \
+#define __glob(pattern, flags, errfunc, pglob) \
   __old_glob64 (pattern, flags, errfunc, pglob)
 #define globfree(pglob) globfree64(pglob)
 
@@ -33,6 +33,9 @@ libc_hidden_proto (__old_glob64);
 #undef __stat
 #define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
 
+/* Avoid calling gl_lstat with GLOB_ALTDIRFUNC.  */
+#define GLOB_NO_LSTAT
+
 #define GLOB_ATTRIBUTE attribute_compat_text_section
 
 #include <posix/glob.c>
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
index e213895c7174cd8a6672dbe284460bc6baa76fa4..385409aa6edd466d5deb7b9eb44469a022f9cdb2 100644 (file)
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
@@ -1986,6 +1986,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
index d25aefd1ae278bceca68444304730ef977e743e5..e99cb454b5d5cfb01088906e99ead5579b8ac6be 100644 (file)
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
@@ -1991,6 +1991,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
index 51a8d19711cb6b590f6bab8513d29e9f1d2e64e5..173672ab5e0f2a24190ab297bd20fb7d5dc2cf71 100644 (file)
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
@@ -2198,3 +2198,6 @@ GLIBC_2.26 strtof128 F
 GLIBC_2.26 strtof128_l F
 GLIBC_2.26 wcstof128 F
 GLIBC_2.26 wcstof128_l F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
index 5eb056baf5d10d2f47187f4d1a208b215536f1cd..8a654436ab6281b8f333b2af31c31503ef376a71 100644 (file)
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
@@ -105,6 +105,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 _Exit F
 GLIBC_2.3 _IO_2_1_stderr_ D 0xe0
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/glob64-lstat-compat.c b/sysdeps/unix/sysv/linux/s390/s390-32/glob64-lstat-compat.c
new file mode 100644 (file)
index 0000000..3016785
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/glob64-lstat-compat.c
@@ -0,0 +1,2 @@
+#define GLOB_NO_OLD_VERSION
+#include <sysdeps/unix/sysv/linux/glob64-lstat-compat.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c b/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c
deleted file mode 100644 (file)
index d220e22..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/glob64.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define GLOB_NO_OLD_VERSION
-#include <sysdeps/unix/sysv/linux/glob64.c>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
index 63d33e8b373c9e533d6ca1b3157d8b0454b396ec..271eccc853d2b32b05b6f6652386719f8cab6277 100644 (file)
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
@@ -1986,6 +1986,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
index b1b2b29c94b4cb64c68adc05f33b0de684f34ed3..8b96e169161e794a4ed52300c3b9fc9aef28be42 100644 (file)
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
@@ -1887,6 +1887,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sh/libc.abilist b/sysdeps/unix/sysv/linux/sh/libc.abilist
index f3a70a0f6f58d0c51e1f2bcb71735d7718358e75..0f840e6e88ba6807fa3e694b7918f7f86d745b42 100644 (file)
--- a/sysdeps/unix/sysv/linux/sh/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libc.abilist
@@ -1872,6 +1872,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
index 8c4c2e502cacfa4aeb5444659297c85091d9d86f..7f7449f52b5f28644c9fa924fe738d056dd4cf79 100644 (file)
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
@@ -1978,6 +1978,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
index 1653164d9e1d918cf76ea4a43f093c3b0c3bcc07..a50485efd8e7fbd04bfc6b6663c2f43e35bb394d 100644 (file)
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
@@ -1916,6 +1916,9 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
index 41647d46103a457985c55d1e30ac583ccc758c49..38a96d3a02053d107de081113ceb2ea34df82507 100644 (file)
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
@@ -2110,3 +2110,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
index 1088923e59f330d305aa018655e5dff2f9745fcc..572b917d7df8d88c34c835405afdaec4941b7fcb 100644 (file)
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
@@ -2110,3 +2110,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
index 41647d46103a457985c55d1e30ac583ccc758c49..38a96d3a02053d107de081113ceb2ea34df82507 100644 (file)
--- a/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
@@ -2110,3 +2110,6 @@ GLIBC_2.26 preadv64v2 F
 GLIBC_2.26 pwritev2 F
 GLIBC_2.26 pwritev64v2 F
 GLIBC_2.26 reallocarray F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
index 8bff2b225b01a9552203725da02efc4621bd52f9..b83d25c2e38d7d52432a9f212c42318be8501f7c 100644 (file)
--- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
@@ -1874,6 +1874,9 @@ GLIBC_2.26 strtof128 F
 GLIBC_2.26 strtof128_l F
 GLIBC_2.26 wcstof128 F
 GLIBC_2.26 wcstof128_l F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
 GLIBC_2.3 GLIBC_2.3 A
 GLIBC_2.3 __ctype_b_loc F
 GLIBC_2.3 __ctype_tolower_loc F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
index d91a03861b6c7e8ea196a10cd10ed6625c488f6e..cba1d590577304309fed0e80df860bb038f06306 100644 (file)
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist
@@ -2117,3 +2117,6 @@ GLIBC_2.26 strtof128 F
 GLIBC_2.26 strtof128_l F
 GLIBC_2.26 wcstof128 F
 GLIBC_2.26 wcstof128_l F
+GLIBC_2.27 GLIBC_2.27 A
+GLIBC_2.27 glob F
+GLIBC_2.27 glob64 F
