This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.18-320-ga471e96


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  a471e96a5352a5f0bde6d32dd36d33524811a2b1 (commit)
      from  45c30c61c9001867c1891f5862764f084e53f348 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a471e96a5352a5f0bde6d32dd36d33524811a2b1

commit a471e96a5352a5f0bde6d32dd36d33524811a2b1
Author: OndÅ?ej Bílka <neleai@seznam.cz>
Date:   Sun Oct 20 10:00:31 2013 +0200

    When glob pattern contains a trailing slash match only directories. Fixes bug 10278.

diff --git a/ChangeLog b/ChangeLog
index 1f2d833..0cb5ada 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2013-10-19  OndÅ?ej Bílka  <neleai@seznam.cz>
 
+	BZ #10278]
+	* posix/glob.c: Match only directories when trailing slash is present.
+	* posix/tst-gnuglob.c (my_opendir): Do not open files.
+	(main): Add testcase.
+
+2013-10-19  OndÅ?ej Bílka  <neleai@seznam.cz>
+
 	[BZ #15670]
 	* time/tzfile.c (__tzfile_read): Replace alloca with malloc.
 
diff --git a/NEWS b/NEWS
index 93f884d..f19c4d5 100644
--- a/NEWS
+++ b/NEWS
@@ -9,13 +9,13 @@ Version 2.19
 
 * The following bugs are resolved with this release:
 
-  156, 431, 832, 13028, 13982, 13985, 14155, 14547, 14699, 14910, 15048,
-  15218, 15277, 15308, 15362, 15400, 15427, 15522, 15531, 15532, 15608,
-  15609, 15610, 15632, 15640, 15670, 15672, 15680, 15681, 15723, 15734,
-  15735, 15736, 15748, 15749, 15754, 15760, 15764, 15797, 15844, 15847,
-  15849, 15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890, 15892,
-  15893, 15895, 15897, 15905, 15909, 15919, 15921, 15923, 15939, 15948,
-  15963, 15966, 15988, 16032, 16034, 16036, 16041.
+  156, 431, 832, 10278, 13028, 13982, 13985, 14155, 14547, 14699, 14910,
+  15048, 15218, 15277, 15308, 15362, 15400, 15427, 15522, 15531, 15532,
+  15608, 15609, 15610, 15632, 15640, 15670, 15672, 15680, 15681, 15723,
+  15734, 15735, 15736, 15748, 15749, 15754, 15760, 15764, 15797, 15844,
+  15847, 15849, 15855, 15856, 15857, 15859, 15867, 15886, 15887, 15890,
+  15892, 15893, 15895, 15897, 15905, 15909, 15919, 15921, 15923, 15939,
+  15948, 15963, 15966, 15988, 16032, 16034, 16036, 16041.
 
 * CVE-2012-4412 The strcoll implementation caches indices and rules for
   large collation sequences to optimize multiple passes.  This cache
diff --git a/posix/glob.c b/posix/glob.c
index ece71c1..85237c2 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -276,6 +276,11 @@ glob (pattern, flags, errfunc, pglob)
       return -1;
     }
 
+  /* POSIX requires all slashes to be matched.  This means that with
+     a trailing slash we must match only directories.  */
+  if (pattern[0] && pattern[strlen (pattern) - 1] == '/')
+    flags |= GLOB_ONLYDIR;
+
   if (!(flags & GLOB_DOOFFS))
     /* Have to do this so `globfree' knows where to start freeing.  It
        also makes all the code that uses gl_offs simpler. */
diff --git a/posix/tst-gnuglob.c b/posix/tst-gnuglob.c
index 0c967d0..6e42724 100644
--- a/posix/tst-gnuglob.c
+++ b/posix/tst-gnuglob.c
@@ -168,7 +168,7 @@ my_opendir (const char *s)
   my_DIR *dir;
 
 
-  if (idx == -1)
+  if (idx == -1 || filesystem[idx].type != DT_DIR)
     {
       PRINTF ("my_opendir(\"%s\") == NULL\n", s);
       return NULL;
@@ -358,7 +358,7 @@ test_result (const char *fmt, int flags, glob_t *gl, const char *str[])
 	      break;
 
 	  if (str[inner] == NULL)
-	    errstr =  ok ? "" : " *** WRONG";
+	    errstr = ok ? "" : " *** WRONG";
 	  else
 	    errstr = ok ? "" : " * wrong position";
 
@@ -483,6 +483,12 @@ main (void)
 	"/file1lev1",
 	"/file2lev1");
 
+  test ("*/*/", 0 , 0,
+	"dir1lev1/dir1lev2/",
+	"dir1lev1/dir2lev2/",
+	"dir1lev1/dir3lev2/",
+	"dir2lev1/dir1lev2/");
+
   test ("", 0, GLOB_NOMATCH, NULL);
 
   test ("", GLOB_NOCHECK, 0, "");

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    7 +++++++
 NEWS                |   14 +++++++-------
 posix/glob.c        |    5 +++++
 posix/tst-gnuglob.c |   10 ++++++++--
 4 files changed, 27 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]