Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 21 Oct 2000 07:30:28 +0000 (07:30 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 21 Oct 2000 07:30:28 +0000 (07:30 +0000)
* posix/fnmatch_loop.c: Make FNM_LEADING_DIR behave as GNU tar
expects it.  Patch by Colin Watson <riva.ucam.org>.
* posix/tst-fnmatch.input: Add test cases for FNM_LEADING_DIR.

ChangeLog
posix/fnmatch_loop.c
posix/tst-fnmatch.input

index c668cab..12839f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2000-10-21  Ulrich Drepper  <drepper@redhat.com>
 
+       * posix/fnmatch_loop.c: Make FNM_LEADING_DIR behave as GNU tar
+       expects it.  Patch by Colin Watson <riva.ucam.org>.
+       * posix/tst-fnmatch.input: Add test cases for FNM_LEADING_DIR.
+
        * elf/dl-open.c (add_to_global): New function.  Split out from
        dl_open_worker.
        (dl_open_worker): Call add_to_global not only for new objects, also for
index 6b20aa4..4c619ed 100644 (file)
@@ -99,25 +99,18 @@ FCT (pattern, string, no_leading_period, flags)
          if (c == L('\0'))
            /* The wildcard(s) is/are the last element of the pattern.
               If the name is a file name and contains another slash
-              this does mean it cannot match.  If the FNM_LEADING_DIR
-              flag is set and exactly one slash is following, we have
-              a match.  */
+              this means it cannot match, unless the FNM_LEADING_DIR
+              flag is set.  */
            {
              int result = (flags & FNM_FILE_NAME) == 0 ? 0 : FNM_NOMATCH;
 
              if (flags & FNM_FILE_NAME)
                {
-                 const CHAR *slashp = STRCHR (n, L('/'));
-
                  if (flags & FNM_LEADING_DIR)
-                   {
-                     if (slashp != NULL
-                         && STRCHR (slashp + 1, L('/')) == NULL)
-                       result = 0;
-                   }
+                   result = 0;
                  else
                    {
-                     if (slashp == NULL)
+                     if (STRCHR (n, L('/')) == NULL)
                        result = 0;
                    }
                }
index 7c79ddc..3e0fb95 100644 (file)
@@ -459,3 +459,26 @@ de_DE.ISO-8859-1 "
 de_DE.ISO-8859-1 "ä"                   "[[=ä=]b]"             0
 de_DE.ISO-8859-1 "b"                   "[[=ä=]b]"             0
 de_DE.ISO-8859-1 "c"                   "[[=ä=]b]"             NOMATCH
+
+# Test of GNU extensions.
+C               "x"                    "x"                    0       PATHNAME|LEADING_DIR
+C               "x/y"                  "x"                    0       PATHNAME|LEADING_DIR
+C               "x/y/z"                "x"                    0       PATHNAME|LEADING_DIR
+C               "x"                    "*"                    0       PATHNAME|LEADING_DIR
+C               "x/y"                  "*"                    0       PATHNAME|LEADING_DIR
+C               "x/y/z"                "*"                    0       PATHNAME|LEADING_DIR
+C               "x"                    "*x"                   0       PATHNAME|LEADING_DIR
+C               "x/y"                  "*x"                   0       PATHNAME|LEADING_DIR
+C               "x/y/z"                "*x"                   0       PATHNAME|LEADING_DIR
+C               "x"                    "x*"                   0       PATHNAME|LEADING_DIR
+C               "x/y"                  "x*"                   0       PATHNAME|LEADING_DIR
+C               "x/y/z"                "x*"                   0       PATHNAME|LEADING_DIR
+C               "x"                    "a"                    NOMATCH PATHNAME|LEADING_DIR
+C               "x/y"                  "a"                    NOMATCH PATHNAME|LEADING_DIR
+C               "x/y/z"                "a"                    NOMATCH PATHNAME|LEADING_DIR
+C               "x"                    "x/y"                  NOMATCH PATHNAME|LEADING_DIR
+C               "x/y"                  "x/y"                  0       PATHNAME|LEADING_DIR
+C               "x/y/z"                "x/y"                  0       PATHNAME|LEADING_DIR
+C               "x"                    "x?y"                  NOMATCH PATHNAME|LEADING_DIR
+C               "x/y"                  "x?y"                  NOMATCH PATHNAME|LEADING_DIR
+C               "x/y/z"                "x?y"                  NOMATCH PATHNAME|LEADING_DIR