* [PATCH] Another test for broken regex mbs handling
@ 2003-11-12 13:04 Jakub Jelinek
2003-11-12 17:48 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-11-12 13:04 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
I believe all tests in the testcase below should pass
(they pass when using A and O as alnum chars and - as !alnum,
but when A is changed into A", O into O" and - into EM DASH,
they suddenly fail).
Volunteers for regex bugfixing (as well as writing new testcases)
are certainly welcome...
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
--- libc/posix/Makefile.jj 2003-11-12 08:25:35.000000000 +0100
+++ libc/posix/Makefile 2003-11-12 13:48:26.000000000 +0100
@@ -77,7 +77,8 @@ tests := tstgetopt testfnm runtests run
tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
- bug-regex17 bug-regex18 tst-nice tst-nanosleep transbug
+ bug-regex17 bug-regex18 bug-regex19 \
+ tst-nice tst-nanosleep transbug
ifeq (yes,$(build-shared))
test-srcs := globtest
tests += wordexp-test tst-exec tst-spawn
@@ -155,6 +156,7 @@ bug-regex5-ENV = LOCPATH=$(common-objpfx
bug-regex6-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex17-ENV = LOCPATH=$(common-objpfx)localedata
bug-regex18-ENV = LOCPATH=$(common-objpfx)localedata
+bug-regex19-ENV = LOCPATH=$(common-objpfx)localedata
testcases.h: TESTS TESTS2C.sed
sed -f TESTS2C.sed < $< > $@T
--- libc/posix/bug-regex19.c.jj 2003-11-12 12:20:58.000000000 +0100
+++ libc/posix/bug-regex19.c 2003-11-12 13:47:32.000000000 +0100
@@ -0,0 +1,112 @@
+/* Regular expression tests.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <mcheck.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+
+static struct
+{
+ int syntax;
+ const char *pattern;
+ const char *string;
+ int start, res;
+} tests[] = {
+ /* \xc3\x84 LATIN CAPITAL LETTER A WITH DIAERESIS
+ \xc3\x96 LATIN CAPITAL LETTER O WITH DIAERESIS
+ \xe2\x80\x94 EM DASH */
+ /* Should not match. */
+ {RE_SYNTAX_POSIX_BASIC, "\\<A", "aOAA", 2, -1},
+ {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAAO", 1, -1},
+ {RE_SYNTAX_POSIX_BASIC, "\\bA", "aOAA", 2, -1},
+ {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAAO", 1, -1},
+ {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 3, -1},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84\xc3\x96", 1, -1},
+#if 0
+ /* XXX Not used since they fail so far. */
+ {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "a\xc3\x96\xc3\x84\xc3\x84", 3, -1},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84\xc3\x96", 1, -1},
+#endif
+ /* Should match. */
+ {RE_SYNTAX_POSIX_BASIC, "\\<A", "AA", 0, 0},
+ {RE_SYNTAX_POSIX_BASIC, "\\<A", "a-AA", 2, 2},
+ {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAA-", 1, 2},
+ {RE_SYNTAX_POSIX_BASIC, "A\\>", "aAA", 1, 2},
+ {RE_SYNTAX_POSIX_BASIC, "\\bA", "AA", 0, 0},
+ {RE_SYNTAX_POSIX_BASIC, "\\bA", "a-AA", 2, 2},
+ {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAA-", 1, 2},
+ {RE_SYNTAX_POSIX_BASIC, "A\\b", "aAA", 1, 2},
+#if 0
+ /* XXX Not used since they fail so far. */
+ {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "\xc3\x84\xc3\x84", 0, 0},
+ {RE_SYNTAX_POSIX_BASIC, "\\<\xc3\x84", "a\xe2\x80\x94\xc3\x84\xc3\x84", 4, 4},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84\xe2\x80\x94", 1, 3},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\>", "a\xc3\x84\xc3\x84", 1, 3},
+ {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "\xc3\x84\xc3\x84", 0, 0},
+ {RE_SYNTAX_POSIX_BASIC, "\\b\xc3\x84", "a\xe2\x80\x94\xc3\x84\xc3\x84", 4, 4},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84\xe2\x80\x94", 1, 3},
+ {RE_SYNTAX_POSIX_BASIC, "\xc3\x84\\b", "a\xc3\x84\xc3\x84", 1, 3}
+#endif
+};
+
+int
+main (void)
+{
+ struct re_pattern_buffer regbuf;
+ const char *err;
+ size_t i;
+ int ret = 0;
+
+ mtrace ();
+
+ setlocale (LC_ALL, "de_DE.UTF-8");
+ for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+ {
+ int res;
+ re_set_syntax (tests[i].syntax);
+ memset (®buf, '\0', sizeof (regbuf));
+ err = re_compile_pattern (tests[i].pattern, strlen (tests[i].pattern),
+ ®buf);
+ if (err != NULL)
+ {
+ printf ("re_compile_pattern failed: %s\n", err);
+ ret = 1;
+ continue;
+ }
+
+ res = re_search (®buf, tests[i].string, strlen (tests[i].string),
+ tests[i].start,
+ strlen (tests[i].string) - tests[i].start, NULL);
+ if (res != tests[i].res)
+ {
+ printf ("re_search %zd failed: %d\n", i, res);
+ ret = 1;
+ regfree (®buf);
+ continue;
+ }
+ regfree (®buf);
+ }
+
+ return ret;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Another test for broken regex mbs handling
2003-11-12 13:04 [PATCH] Another test for broken regex mbs handling Jakub Jelinek
@ 2003-11-12 17:48 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-11-12 17:48 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Roland McGrath, Glibc hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've applied all the regex patches and the ftw patch. Thanks,
- --
⧠Ulrich Drepper ⧠Red Hat, Inc. ⧠444 Castro St ⧠Mountain View, CA â
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/snJH2ijCOnn/RHQRAsxcAJ9P8wp9bRJBzd4YyKTXkpsCIz1t4ACglCAf
1GiIKPI/OSZq5sVDdQrSyn0=
=dS2R
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-12 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-12 13:04 [PATCH] Another test for broken regex mbs handling Jakub Jelinek
2003-11-12 17:48 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).