Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
/* Regular expression tests.
|
2022-01-01 18:54:23 +00:00
|
|
|
Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
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
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <mcheck.h>
|
|
|
|
#include <regex.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <locale.h>
|
Fix stringop-overflow warning in bug-regex19.c.
Starting with commit
26492c0a14966c32c43cd6ca1d0dca5e62c6cfef
"Annotate additional APIs with GCC attribute access.",
gcc emits this warning on s390x:
In function 'do_one_test',
inlined from 'do_mb_tests' at bug-regex19.c:385:11:
bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
271 | res = re_search (®buf, test->string, strlen (test->string),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 | test->start, strlen (test->string) - test->start, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/regex.h:2,
from bug-regex19.c:22:
bug-regex19.c: In function 'do_mb_tests':
../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)'
554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer,
| ^~~~~~~~~
...
The function do_one_test is inlined into do_mb_tests on s390x (at least with
gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are
no warnings on s390x. If do_one_test is marked with
__attribute__ ((always_inline)), there are the same warnings on x86_64.
test->string points to a variable length array on stack of do_mb_tests
and the content is generated based on the passed test struct.
According to Martin Sebor, this is a false positive caused by the same bug as
the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in
the next GCC 10.4 release.
2021-05-17 14:19:36 +00:00
|
|
|
#include <libc-diag.h>
|
Add generic C.UTF-8 locale (Bug 17318)
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
is provided as a distinct locale. The locale provides full support for
UTF-8 and this includes full code point sorting via STRCMP-based
collation (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_collation' which drops all
collation rules and generates an empty zero rules collation to enable
STRCMP usage in collation. This ensures that we get full code point
sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
The new locale is added to SUPPORTED. Minimal test data for specific
code points (minus those not supported by collate-test) is provided in
C.UTF-8.in, and this verifies code point sorting is working reasonably
across the range. The locale was tested manually with the full set of
code points without failure.
The locale is harmonized with locales already shipping in various
downstream distributions. A new tst-iconv9 test is added which verifies
the C.UTF-8 locale is generally usable.
Testing for fnmatch, regexec, and recomp is provided by extending
bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
tst-regcomp-truncated, and tst-regex to use C.UTF-8.
Tested on x86_64 or i686 without regression.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-09-01 19:19:19 +00:00
|
|
|
#include <support/support.h>
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
|
2003-11-21 09:20:45 +00:00
|
|
|
#define BRE RE_SYNTAX_POSIX_BASIC
|
|
|
|
#define ERE RE_SYNTAX_POSIX_EXTENDED
|
|
|
|
|
|
|
|
static struct test_s
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
{
|
|
|
|
int syntax;
|
|
|
|
const char *pattern;
|
|
|
|
const char *string;
|
|
|
|
int start, res;
|
|
|
|
} tests[] = {
|
2003-11-21 09:20:45 +00:00
|
|
|
{BRE, "\\<A", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\<A", "CBAA", 2, -1},
|
|
|
|
{BRE, "A\\>", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\bA", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\bA", "CBAA", 2, -1},
|
|
|
|
{BRE, "A\\b", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\<A", "AA", 0, 0},
|
|
|
|
{BRE, "\\<A", "C-AA", 2, 2},
|
|
|
|
{BRE, "A\\>", "CAA-", 1, 2},
|
|
|
|
{BRE, "A\\>", "CAA", 1, 2},
|
|
|
|
{BRE, "\\bA", "AA", 0, 0},
|
|
|
|
{BRE, "\\bA", "C-AA", 2, 2},
|
|
|
|
{BRE, "A\\b", "CAA-", 1, 2},
|
|
|
|
{BRE, "A\\b", "CAA", 1, 2},
|
2003-11-21 22:43:47 +00:00
|
|
|
{BRE, "\\<[A]", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\<[A]", "CBAA", 2, -1},
|
|
|
|
{BRE, "[A]\\>", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\b[A]", "CBAA", 0, -1},
|
|
|
|
{BRE, "\\b[A]", "CBAA", 2, -1},
|
|
|
|
{BRE, "[A]\\b", "CAAB", 1, -1},
|
|
|
|
{BRE, "\\<[A]", "AA", 0, 0},
|
|
|
|
{BRE, "\\<[A]", "C-AA", 2, 2},
|
|
|
|
{BRE, "[A]\\>", "CAA-", 1, 2},
|
|
|
|
{BRE, "[A]\\>", "CAA", 1, 2},
|
|
|
|
{BRE, "\\b[A]", "AA", 0, 0},
|
|
|
|
{BRE, "\\b[A]", "C-AA", 2, 2},
|
|
|
|
{BRE, "[A]\\b", "CAA-", 1, 2},
|
|
|
|
{BRE, "[A]\\b", "CAA", 1, 2},
|
2003-11-21 09:20:45 +00:00
|
|
|
{ERE, "\\b(A|!|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "DA!C", 0, 2},
|
|
|
|
{ERE, "\\b(A|!|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "D,B", 0, 1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\b(A|!|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DAAD", 0, 1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DABD", 0, 1},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "AD", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "C!", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "D,B", 0, 2},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DA?A", 0, 3},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "BBC", 0, 0},
|
|
|
|
{ERE, "(A|\\b)(A|B|C)", "DA", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "A!=\\", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "/!=A", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "A=A", 0, 1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "==!=", 0, 2},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "==C~", 0, 3},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "=~=", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "~!", 0, -1},
|
|
|
|
{ERE, "(!|\\b)(!|=|~)", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\b|A.)[A~C]", "B~C", 0, 1},
|
|
|
|
{ERE, ".\\b.", "AA~", 0, 1},
|
|
|
|
{ERE, ".\\b.", "=A=", 0, 0},
|
|
|
|
{ERE, ".\\b.", "==", 0, -1},
|
|
|
|
{ERE, ".\\b.", "ABA", 0, -1},
|
2003-11-24 19:30:51 +00:00
|
|
|
{ERE, "[^k]\\b[^k]", "AA~", 0, 1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "=A=", 0, 0},
|
|
|
|
{ERE, "[^k]\\b[^k]", "Ak~kA~", 0, 4},
|
|
|
|
{ERE, "[^k]\\b[^k]", "==", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "Ak~", 0, -1},
|
|
|
|
{ERE, "[^k]\\b[^k]", "k=k", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AA~", 0, 1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "=A=", 0, 0},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AC~CA~", 0, 4},
|
|
|
|
{ERE, "[^C]\\b[^C]", "==", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "AC~", 0, -1},
|
|
|
|
{ERE, "[^C]\\b[^C]", "C=C", 0, -1},
|
2003-11-21 09:20:45 +00:00
|
|
|
{ERE, "\\<(A|!|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "DA!C", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "D,B", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\<(A|!|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DAAD", 0, 1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DABD", 0, 1},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "AD", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "C!", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "D,B", 0, 2},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DA?A", 0, 3},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "BBC", 0, 0},
|
|
|
|
{ERE, "(A|\\<)(A|B|C)", "DA", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "A!=\\", 0, 1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "/!=A", 0, 1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "==!=", 0, 2},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "==C~", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "A=A", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "=~=", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "~!", 0, -1},
|
|
|
|
{ERE, "(!|\\<)(!|=|~)", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\<|A.)[A~C]", "B~C", 0, 2},
|
|
|
|
{ERE, ".\\<.", "=A=", 0, 0},
|
|
|
|
{ERE, ".\\<.", "AA~", 0, -1},
|
|
|
|
{ERE, ".\\<.", "==", 0, -1},
|
|
|
|
{ERE, ".\\<.", "ABA", 0, -1},
|
2003-11-24 19:30:51 +00:00
|
|
|
{ERE, "[^k]\\<[^k]", "=k=A=", 0, 2},
|
|
|
|
{ERE, "[^k]\\<[^k]", "kk~", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "==", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^k]\\<[^k]", "=k=", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "=C=A=", 0, 2},
|
|
|
|
{ERE, "[^C]\\<[^C]", "CC~", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "==", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "ABA", 0, -1},
|
|
|
|
{ERE, "[^C]\\<[^C]", "=C=", 0, -1},
|
2003-11-21 09:20:45 +00:00
|
|
|
{ERE, ".\\B.", "ABA", 0, 0},
|
|
|
|
{ERE, ".\\B.", "=BDC", 0, 1},
|
2003-11-24 19:30:51 +00:00
|
|
|
{ERE, "[^k]\\B[^k]", "kkkABA", 0, 3},
|
|
|
|
{ERE, "[^k]\\B[^k]", "kBk", 0, -1},
|
|
|
|
{ERE, "[^C]\\B[^C]", "CCCABA", 0, 3},
|
|
|
|
{ERE, "[^C]\\B[^C]", "CBC", 0, -1},
|
2005-01-26 19:56:03 +00:00
|
|
|
{ERE, ".(\\b|\\B).", "=~AB", 0, 0},
|
2003-11-21 09:20:45 +00:00
|
|
|
{ERE, ".(\\b|\\B).", "A=C", 0, 0},
|
|
|
|
{ERE, ".(\\b|\\B).", "ABC", 0, 0},
|
2005-01-26 19:56:03 +00:00
|
|
|
{ERE, ".(\\b|\\B).", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~AB", 0, 0},
|
2003-11-24 19:30:51 +00:00
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "A=C", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "ABC", 0, 0},
|
2005-01-26 19:56:03 +00:00
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~kBD", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^k](\\b|\\B)[^k]", "=~kB", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~AB", 0, 0},
|
2003-11-24 19:30:51 +00:00
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "A=C", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "ABC", 0, 0},
|
2005-01-26 19:56:03 +00:00
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~CBD", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~\\!", 0, 0},
|
|
|
|
{ERE, "[^C](\\b|\\B)[^C]", "=~CB", 0, 0},
|
2003-11-21 22:43:47 +00:00
|
|
|
{ERE, "\\b([A]|[!]|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "DA!C", 0, 2},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "D,B", 0, 1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\b([A]|[!]|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DAAD", 0, 1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DABD", 0, 1},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "AD", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "C!", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "D,B", 0, 2},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DA?A", 0, 3},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "BBC", 0, 0},
|
|
|
|
{ERE, "([A]|\\b)([A]|[B]|[C])", "DA", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "A!=\\", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "/!=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "A=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "==!=", 0, 2},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "==C~", 0, 3},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "=~=", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "~!", 0, -1},
|
|
|
|
{ERE, "([!]|\\b)([!]|[=]|[~])", "~=~", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "A=AC", 0, 0},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=AC", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!AC", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=AB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "=CB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!CB", 0, 1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "DA!C", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "D,B", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "!.C", 0, -1},
|
|
|
|
{ERE, "\\<([A]|[!]|.B)", "BCB", 0, -1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DAAD", 0, 1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DABD", 0, 1},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "AD", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "C!", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "D,B", 0, 2},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DA?A", 0, 3},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "BBC", 0, 0},
|
|
|
|
{ERE, "([A]|\\<)([A]|[B]|[C])", "DA", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "A!=\\", 0, 1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "/!=A", 0, 1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "==!=", 0, 2},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "==C~", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "A=A", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "=~=", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "~!", 0, -1},
|
|
|
|
{ERE, "([!]|\\<)([!=]|[~])", "~=~", 0, -1},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[ABC]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "AC", 0, 0},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "=A", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "DACC", 0, 1},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "B!A=", 0, 2},
|
|
|
|
{ERE, "(\\<|[A].)[A~C]", "B~C", 0, 2},
|
2003-12-22 06:52:35 +00:00
|
|
|
{ERE, "^[^A]*\\bB", "==B", 0, 0},
|
|
|
|
{ERE, "^[^A]*\\bB", "CBD!=B", 0, 0},
|
|
|
|
{ERE, "[^A]*\\bB", "==B", 2, 2}
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2003-11-21 09:20:45 +00:00
|
|
|
do_one_test (const struct test_s *test, const char *fail)
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
{
|
2003-11-21 09:20:45 +00:00
|
|
|
int res;
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
const char *err;
|
2003-11-21 09:20:45 +00:00
|
|
|
struct re_pattern_buffer regbuf;
|
|
|
|
|
|
|
|
re_set_syntax (test->syntax);
|
|
|
|
memset (®buf, '\0', sizeof (regbuf));
|
|
|
|
err = re_compile_pattern (test->pattern, strlen (test->pattern),
|
|
|
|
®buf);
|
|
|
|
if (err != NULL)
|
|
|
|
{
|
|
|
|
printf ("%sre_compile_pattern \"%s\" failed: %s\n", fail, test->pattern,
|
|
|
|
err);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
Fix stringop-overflow warning in bug-regex19.c.
Starting with commit
26492c0a14966c32c43cd6ca1d0dca5e62c6cfef
"Annotate additional APIs with GCC attribute access.",
gcc emits this warning on s390x:
In function 'do_one_test',
inlined from 'do_mb_tests' at bug-regex19.c:385:11:
bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
271 | res = re_search (®buf, test->string, strlen (test->string),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 | test->start, strlen (test->string) - test->start, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/regex.h:2,
from bug-regex19.c:22:
bug-regex19.c: In function 'do_mb_tests':
../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)'
554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer,
| ^~~~~~~~~
...
The function do_one_test is inlined into do_mb_tests on s390x (at least with
gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are
no warnings on s390x. If do_one_test is marked with
__attribute__ ((always_inline)), there are the same warnings on x86_64.
test->string points to a variable length array on stack of do_mb_tests
and the content is generated based on the passed test struct.
According to Martin Sebor, this is a false positive caused by the same bug as
the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in
the next GCC 10.4 release.
2021-05-17 14:19:36 +00:00
|
|
|
#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
|
|
|
|
DIAG_PUSH_NEEDS_COMMENT;
|
|
|
|
/* Avoid GCC 10 false positive warning: specified size exceeds maximum
|
|
|
|
object size. */
|
|
|
|
DIAG_IGNORE_NEEDS_COMMENT (10, "-Wstringop-overflow");
|
|
|
|
#endif
|
2003-11-21 09:20:45 +00:00
|
|
|
res = re_search (®buf, test->string, strlen (test->string),
|
|
|
|
test->start, strlen (test->string) - test->start, NULL);
|
Fix stringop-overflow warning in bug-regex19.c.
Starting with commit
26492c0a14966c32c43cd6ca1d0dca5e62c6cfef
"Annotate additional APIs with GCC attribute access.",
gcc emits this warning on s390x:
In function 'do_one_test',
inlined from 'do_mb_tests' at bug-regex19.c:385:11:
bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
271 | res = re_search (®buf, test->string, strlen (test->string),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 | test->start, strlen (test->string) - test->start, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/regex.h:2,
from bug-regex19.c:22:
bug-regex19.c: In function 'do_mb_tests':
../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)'
554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer,
| ^~~~~~~~~
...
The function do_one_test is inlined into do_mb_tests on s390x (at least with
gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are
no warnings on s390x. If do_one_test is marked with
__attribute__ ((always_inline)), there are the same warnings on x86_64.
test->string points to a variable length array on stack of do_mb_tests
and the content is generated based on the passed test struct.
According to Martin Sebor, this is a false positive caused by the same bug as
the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in
the next GCC 10.4 release.
2021-05-17 14:19:36 +00:00
|
|
|
#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
|
|
|
|
DIAG_POP_NEEDS_COMMENT;
|
|
|
|
#endif
|
2003-11-21 09:20:45 +00:00
|
|
|
if (res != test->res)
|
|
|
|
{
|
|
|
|
printf ("%sre_search \"%s\" \"%s\" failed: %d (expected %d)\n",
|
|
|
|
fail, test->pattern, test->string, res, test->res);
|
|
|
|
regfree (®buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test->res > 0 && test->start == 0)
|
|
|
|
{
|
Fix stringop-overflow warning in bug-regex19.c.
Starting with commit
26492c0a14966c32c43cd6ca1d0dca5e62c6cfef
"Annotate additional APIs with GCC attribute access.",
gcc emits this warning on s390x:
In function 'do_one_test',
inlined from 'do_mb_tests' at bug-regex19.c:385:11:
bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
271 | res = re_search (®buf, test->string, strlen (test->string),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 | test->start, strlen (test->string) - test->start, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/regex.h:2,
from bug-regex19.c:22:
bug-regex19.c: In function 'do_mb_tests':
../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)'
554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer,
| ^~~~~~~~~
...
The function do_one_test is inlined into do_mb_tests on s390x (at least with
gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are
no warnings on s390x. If do_one_test is marked with
__attribute__ ((always_inline)), there are the same warnings on x86_64.
test->string points to a variable length array on stack of do_mb_tests
and the content is generated based on the passed test struct.
According to Martin Sebor, this is a false positive caused by the same bug as
the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in
the next GCC 10.4 release.
2021-05-17 14:19:36 +00:00
|
|
|
#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
|
|
|
|
DIAG_PUSH_NEEDS_COMMENT;
|
|
|
|
/* Avoid GCC 10 false positive warning: specified size exceeds maximum
|
|
|
|
object size. */
|
|
|
|
DIAG_IGNORE_NEEDS_COMMENT (10, "-Wstringop-overflow");
|
|
|
|
#endif
|
2003-11-21 09:20:45 +00:00
|
|
|
res = re_search (®buf, test->string, strlen (test->string),
|
|
|
|
test->res, strlen (test->string) - test->res, NULL);
|
Fix stringop-overflow warning in bug-regex19.c.
Starting with commit
26492c0a14966c32c43cd6ca1d0dca5e62c6cfef
"Annotate additional APIs with GCC attribute access.",
gcc emits this warning on s390x:
In function 'do_one_test',
inlined from 'do_mb_tests' at bug-regex19.c:385:11:
bug-regex19.c:271:9: error: 're_search' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
271 | res = re_search (®buf, test->string, strlen (test->string),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 | test->start, strlen (test->string) - test->start, NULL);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../include/regex.h:2,
from bug-regex19.c:22:
bug-regex19.c: In function 'do_mb_tests':
../posix/regex.h:554:17: note: in a call to function 're_search' declared with attribute 'read_only (2, 3)'
554 | extern regoff_t re_search (struct re_pattern_buffer *__buffer,
| ^~~~~~~~~
...
The function do_one_test is inlined into do_mb_tests on s390x (at least with
gcc 10). If do_one_test is marked with __attribute__ ((noinline)), there are
no warnings on s390x. If do_one_test is marked with
__attribute__ ((always_inline)), there are the same warnings on x86_64.
test->string points to a variable length array on stack of do_mb_tests
and the content is generated based on the passed test struct.
According to Martin Sebor, this is a false positive caused by the same bug as
the one in nss/makedb.c. It's fixed in GCC 11 and will also be available in
the next GCC 10.4 release.
2021-05-17 14:19:36 +00:00
|
|
|
#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
|
|
|
|
DIAG_POP_NEEDS_COMMENT;
|
|
|
|
#endif
|
2003-11-21 09:20:45 +00:00
|
|
|
if (res != test->res)
|
|
|
|
{
|
|
|
|
printf ("%sre_search from expected \"%s\" \"%s\" failed: %d (expected %d)\n",
|
|
|
|
fail, test->pattern, test->string, res, test->res);
|
|
|
|
regfree (®buf);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
regfree (®buf);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
replace (char *p, char c)
|
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
/* A -> A" */
|
|
|
|
case 'A': *p++ = '\xc3'; *p++ = '\x84'; break;
|
|
|
|
/* B -> O" */
|
|
|
|
case 'B': *p++ = '\xc3'; *p++ = '\x96'; break;
|
|
|
|
/* C -> U" */
|
|
|
|
case 'C': *p++ = '\xc3'; *p++ = '\x9c'; break;
|
|
|
|
/* D -> a" */
|
|
|
|
case 'D': *p++ = '\xc3'; *p++ = '\xa4'; break;
|
|
|
|
/* ! -> MULTIPLICATION SIGN */
|
|
|
|
case '!': *p++ = '\xc3'; *p++ = '\x97'; break;
|
|
|
|
/* = -> EM DASH */
|
|
|
|
case '=': *p++ = '\xe2'; *p++ = '\x80'; *p++ = '\x94'; break;
|
|
|
|
/* ~ -> MUSICAL SYMBOL HALF NOTE */
|
|
|
|
case '~': *p++ = '\xf0'; *p++ = '\x9d'; *p++ = '\x85'; *p++ = '\x9e';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
do_mb_tests (const struct test_s *test)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
struct test_s t;
|
|
|
|
const char *const chars = "ABCD!=~";
|
|
|
|
char repl[8], *p;
|
|
|
|
char pattern[strlen (test->pattern) * 4 + 1];
|
|
|
|
char string[strlen (test->string) * 4 + 1];
|
|
|
|
char fail[8 + sizeof ("UTF-8 ")];
|
|
|
|
|
2003-11-24 19:30:51 +00:00
|
|
|
t = *test;
|
2003-11-21 09:20:45 +00:00
|
|
|
t.pattern = pattern;
|
|
|
|
t.string = string;
|
|
|
|
strcpy (fail, "UTF-8 ");
|
|
|
|
for (i = 1; i < 128; ++i)
|
|
|
|
{
|
|
|
|
p = repl;
|
|
|
|
for (j = 0; j < 7; ++j)
|
|
|
|
if (i & (1 << j))
|
|
|
|
{
|
|
|
|
if (!strchr (test->pattern, chars[j])
|
|
|
|
&& !strchr (test->string, chars[j]))
|
|
|
|
break;
|
|
|
|
*p++ = chars[j];
|
|
|
|
}
|
|
|
|
if (j < 7)
|
|
|
|
continue;
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
for (j = 0, p = pattern; test->pattern[j]; ++j)
|
|
|
|
if (strchr (repl, test->pattern[j]))
|
|
|
|
p = replace (p, test->pattern[j]);
|
|
|
|
else if (test->pattern[j] == '\\' && test->pattern[j + 1])
|
|
|
|
{
|
|
|
|
*p++ = test->pattern[j++];
|
|
|
|
*p++ = test->pattern[j];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*p++ = test->pattern[j];
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
t.start = test->start;
|
|
|
|
t.res = test->res;
|
|
|
|
|
|
|
|
for (j = 0, p = string; test->string[j]; ++j)
|
|
|
|
if (strchr (repl, test->string[j]))
|
|
|
|
{
|
|
|
|
char *d = replace (p, test->string[j]);
|
|
|
|
if (test->start > j)
|
|
|
|
t.start += d - p - 1;
|
|
|
|
if (test->res > j)
|
|
|
|
t.res += d - p - 1;
|
|
|
|
p = d;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*p++ = test->string[j];
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
p = stpcpy (fail + strlen ("UTF-8 "), repl);
|
|
|
|
*p++ = ' ';
|
|
|
|
*p = '\0';
|
|
|
|
|
|
|
|
if (do_one_test (&t, fail))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Add generic C.UTF-8 locale (Bug 17318)
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
is provided as a distinct locale. The locale provides full support for
UTF-8 and this includes full code point sorting via STRCMP-based
collation (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_collation' which drops all
collation rules and generates an empty zero rules collation to enable
STRCMP usage in collation. This ensures that we get full code point
sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
The new locale is added to SUPPORTED. Minimal test data for specific
code points (minus those not supported by collate-test) is provided in
C.UTF-8.in, and this verifies code point sorting is working reasonably
across the range. The locale was tested manually with the full set of
code points without failure.
The locale is harmonized with locales already shipping in various
downstream distributions. A new tst-iconv9 test is added which verifies
the C.UTF-8 locale is generally usable.
Testing for fnmatch, regexec, and recomp is provided by extending
bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
tst-regcomp-truncated, and tst-regex to use C.UTF-8.
Tested on x86_64 or i686 without regression.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-09-01 19:19:19 +00:00
|
|
|
static int
|
|
|
|
do_test (void)
|
2003-11-21 09:20:45 +00:00
|
|
|
{
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
size_t i;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
mtrace ();
|
|
|
|
|
|
|
|
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
|
|
|
|
{
|
Add generic C.UTF-8 locale (Bug 17318)
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
is provided as a distinct locale. The locale provides full support for
UTF-8 and this includes full code point sorting via STRCMP-based
collation (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_collation' which drops all
collation rules and generates an empty zero rules collation to enable
STRCMP usage in collation. This ensures that we get full code point
sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
The new locale is added to SUPPORTED. Minimal test data for specific
code points (minus those not supported by collate-test) is provided in
C.UTF-8.in, and this verifies code point sorting is working reasonably
across the range. The locale was tested manually with the full set of
code points without failure.
The locale is harmonized with locales already shipping in various
downstream distributions. A new tst-iconv9 test is added which verifies
the C.UTF-8 locale is generally usable.
Testing for fnmatch, regexec, and recomp is provided by extending
bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
tst-regcomp-truncated, and tst-regex to use C.UTF-8.
Tested on x86_64 or i686 without regression.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-09-01 19:19:19 +00:00
|
|
|
xsetlocale (LC_ALL, "de_DE.ISO-8859-1");
|
2003-11-21 09:20:45 +00:00
|
|
|
ret |= do_one_test (&tests[i], "");
|
Add generic C.UTF-8 locale (Bug 17318)
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
is provided as a distinct locale. The locale provides full support for
UTF-8 and this includes full code point sorting via STRCMP-based
collation (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_collation' which drops all
collation rules and generates an empty zero rules collation to enable
STRCMP usage in collation. This ensures that we get full code point
sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
The new locale is added to SUPPORTED. Minimal test data for specific
code points (minus those not supported by collate-test) is provided in
C.UTF-8.in, and this verifies code point sorting is working reasonably
across the range. The locale was tested manually with the full set of
code points without failure.
The locale is harmonized with locales already shipping in various
downstream distributions. A new tst-iconv9 test is added which verifies
the C.UTF-8 locale is generally usable.
Testing for fnmatch, regexec, and recomp is provided by extending
bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
tst-regcomp-truncated, and tst-regex to use C.UTF-8.
Tested on x86_64 or i686 without regression.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-09-01 19:19:19 +00:00
|
|
|
xsetlocale (LC_ALL, "de_DE.UTF-8");
|
|
|
|
ret |= do_one_test (&tests[i], "UTF-8 ");
|
|
|
|
ret |= do_mb_tests (&tests[i]);
|
|
|
|
xsetlocale (LC_ALL, "C.UTF-8");
|
2003-11-21 09:20:45 +00:00
|
|
|
ret |= do_one_test (&tests[i], "UTF-8 ");
|
2003-11-24 19:30:51 +00:00
|
|
|
ret |= do_mb_tests (&tests[i]);
|
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
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.
2003-11-12 17:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
Add generic C.UTF-8 locale (Bug 17318)
We add a new C.UTF-8 locale. This locale is not builtin to glibc, but
is provided as a distinct locale. The locale provides full support for
UTF-8 and this includes full code point sorting via STRCMP-based
collation (strcmp or wcscmp).
The collation uses a new keyword 'codepoint_collation' which drops all
collation rules and generates an empty zero rules collation to enable
STRCMP usage in collation. This ensures that we get full code point
sorting for C.UTF-8 with a minimal 1406 bytes of overhead (LC_COLLATE
structure information and ASCII collating tables).
The new locale is added to SUPPORTED. Minimal test data for specific
code points (minus those not supported by collate-test) is provided in
C.UTF-8.in, and this verifies code point sorting is working reasonably
across the range. The locale was tested manually with the full set of
code points without failure.
The locale is harmonized with locales already shipping in various
downstream distributions. A new tst-iconv9 test is added which verifies
the C.UTF-8 locale is generally usable.
Testing for fnmatch, regexec, and recomp is provided by extending
bug-regex1, bugregex19, bug-regex4, bug-regex6, transbug, tst-fnmatch,
tst-regcomp-truncated, and tst-regex to use C.UTF-8.
Tested on x86_64 or i686 without regression.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2021-09-01 19:19:19 +00:00
|
|
|
|
|
|
|
#include <support/test-driver.c>
|