[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] Add a test for glibc's Bugzilla bug #12378.
From: |
James Youngman |
Subject: |
[PATCH 2/2] Add a test for glibc's Bugzilla bug #12378. |
Date: |
Thu, 12 May 2011 01:06:54 +0100 |
From: James Youngman <address@hidden>
* m4/fnmatch.m4: Use gnulib's fnmatch if the system fnmatch
doesn't allow the literal matching of a lone "[" (which is
required by POSIX).
* tests/test-fnmatch.c (main): Check that "[/b" matches itself.
Signed-off-by: James Youngman <address@hidden>
---
ChangeLog | 8 ++++++++
m4/fnmatch.m4 | 2 ++
tests/test-fnmatch.c | 6 ++++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 245cbbf..e0be34a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-12 James Youngman <address@hidden>
+
+ Add a test for glibc's Bugzilla bug #12378.
+ * m4/fnmatch.m4: Use gnulib's fnmatch if the system fnmatch
+ doesn't allow the literal matching of a lone "[" (which is
+ required by POSIX).
+ * tests/test-fnmatch.c (main): Check that "[/b" matches itself.
+
2011-05-11 Ulrich Drepper <address@hidden>
Backport glibc change fixing Bugzilla bug #12378.
diff --git a/m4/fnmatch.m4 b/m4/fnmatch.m4
index c8ed9e7..0d9ec51 100644
--- a/m4/fnmatch.m4
+++ b/m4/fnmatch.m4
@@ -65,6 +65,8 @@ AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
return 1;
if (!y ("a*", "abc", 0))
return 1;
+ if (!y ("@<:@/b", "@<:@/b", 0)) /* glibc Bugzilla bug 12378 */
+ return 1;
if (!n ("d*/*1", "d/s/1", FNM_PATHNAME))
return 2;
if (!y ("a\\\\bc", "abc", 0))
diff --git a/tests/test-fnmatch.c b/tests/test-fnmatch.c
index 66f9b1c..71664a8 100644
--- a/tests/test-fnmatch.c
+++ b/tests/test-fnmatch.c
@@ -46,5 +46,11 @@ main ()
ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", 0) == 0);
ASSERT (res = fnmatch ("foo\\.txt", "foo.txt", FNM_NOESCAPE) == FNM_NOMATCH);
+ /* Verify that an unmatched [ is treated as a literal, as POSIX
+ requires. This test ensures that glibc Bugzilla bug #12378 stays
+ fixed.
+ */
+ ASSERT (res = fnmatch ("[/b", "[/b", 0) == 0);
+
return 0;
}
--
1.7.2.5