tests/test-regex.c


Log

Author Commit Date CI Message
Simon Josefsson 32a72f45 2023-01-01T01:14:21 maint: run 'make update-copyright'
Bernhard Voelker 87e6634b 2022-01-04T00:16:50 license: fix GPLv3 texts to use a comma instead of semicolon. See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
Paul Eggert eec12c00 2022-01-01T09:43:19 maint: run 'make update-copyright'
Paul Eggert e707dbe7 2021-07-14T23:55:30 regex: modernize to newer regex bugset Problem reported by Hiroo Hayashi in: https://lists.gnu.org/r/bug-gnulib/2021-07/msg00024.html * m4/regex.m4 (gl_REGEX): Allow newer glibc behavior for ()0|\1, behavior where the regex compiles but does not match. Test for glibc bug 11053. * tests/test-regex.c (bug_regex11, main): Add casts needed for printf portability. (main): Allow newer glibc behavior for ()0|\1.
Dmitry V. Levin 19d67047 2021-06-06T08:00:00 regex-tests: test for regressions fixed by the previous commit * tests/test-regex.c (tests): Add test cases for *+ and ** regressions fixed by the previous commit. Link: https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00134.html
Dmitry V. Levin 599ecba3 2021-06-06T08:00:00 regex-tests: remove incorrect comment * tests/test-regex.c (tests): Remove the comment saying that some tests are not used. That comment was copied along with tests from glibc where some of these tests are commented out. Fixes: 70b673eb7 ("regex: fix longstanding backref match bug")
Paul Eggert e3a06e1c 2021-02-05T17:08:39 regex-tests: add bug 11053 test * tests/test-regex.c (main): New test case for glibc bug 11053.
Paul Eggert 70b673eb 2021-02-05T17:08:10 regex: fix longstanding backref match bug This fixes a longstanding glibc bug concerning backreferences <https://sourceware.org/11053> (2009-12-04). * lib/regexec.c (proceed_next_node, push_fail_stack) (pop_fail_stack): Push and pop the previous registers as well as the current ones. All callers changed. (set_regs): Also pop if CUR_NODE has already been checked, so that it does not get added as a duplicate set entry. (update_regs): Fix comment location. * tests/test-regex.c (tests): New constant. (bug_regex11): New test function. (main): Bump alarm value. Call new test function.
Paul Eggert a588d480 2021-02-05T16:35:46 regex-tests: fix typo * tests/test-regex.c (main): Fix typo that would have caused an old test case to report incorrect values on failure.
Paul Eggert 4b948321 2021-01-01T07:28:52 maint: run 'make update-copyright'
Jim Meyering 18d02b74 2020-12-29T20:00:36 regex-tests: tweak to avoid a clang-10 warning * tests/test-regex.c: Compare with explicit zero, rather than as boolean to avoid this from clang-10: test-regex.c:315:9: error: converting the result of '<<' to a \ boolean always evaluates to true \ [-Werror,-Wtautological-constant-compare] if (! REG_STARTEND)
Bruno Haible b3865ddc 2020-09-26T15:57:08 regex-tests: Make test more robust. * tests/test-regex.c (main): Make sure to revert the locale to "C" after the test in "tr_TR.UTF-8" locale. Exit if we can't revert it.
Paul Eggert 16cd53b1 2020-09-25T19:00:53 regex-tests: fix possible Turkish false-alarm * modules/regex-tests (Depends-on): Add wctype-h. * tests/test-regex.c: Include wctype.h. (main): Check that ‘i’ uppercases to ‘İ’ in Turkish, as the Turkish regex test assumes this.
Paul Eggert 5f0a97fc 2020-09-25T16:02:36 regex-tests: fix test and add debug output Perhaps this will fix the recent grep test failure reported at: https://buildfarm.opencsw.org/buildbot/builders/ggrep-solaris10-sparc/builds/199 At least, the debug output should help narrow down the failure. * tests/test-regex.c: Include stdarg.h, stdio.h. (exit_status): New var. (report_error): New function. (main): Use it to report failures to stdout instead of merely exiting with some nonzero status. The status info alone isn’t enough to do remote debugging. In the new tr_TR.UTF-8 test, clear regex before calling re_compile_pattern, fixing a portability bug.
Paul Eggert 0c487ff1 2020-09-23T17:03:45 regex: fix ignore-case Turkish bug * lib/regex_internal.c (build_wcs_upper_buffer): Do not assume that converting single-byte character to upper yields a single-byte character. This is not true for Turkish, where towupper (L'i') yields L'İ', which is not single-byte. * tests/test-regex.c (main): Test for this bug.
Paul Eggert 2cdc1baf 2020-01-01T00:00:18 maint: Run 'make update-copyright'
Paul Eggert e6633650 2019-01-01T00:25:11 maint: Run 'make update-copyright'
Jim Meyering 55a4abd9 2018-12-15T15:24:21 regex: work around a bug in glibc-2.27 and prior * m4/regex.m4 (gl_REGEX): Reject any system regexp that gets a failed assertion for /0|()0|\1|0/. * tests/test-regex.c (main): Add the same test here.
Paul Eggert 281b825e 2018-01-01T00:57:25 maint: Run 'make update-copyright'
Jim Meyering 2a3dbe99 2017-11-12T09:13:30 maint: shorten https://lists.gnu.org/archive/html/... links Each /archive/html/ part can be replace with /r/. Run this to induce the change: git grep -l archive/html|xargs perl -pi -e 's,/archive/html/,/r/,g' * ChangeLog: Perform that substitution. * Makefile: Likewise. * STATUS-libposix: Likewise. * build-aux/bootstrap: Likewise. * doc/maintain.texi: Likewise. * gnulib-tool: Likewise. * lib/allocator.h: Likewise. * lib/argp-ba.c: Likewise. * lib/argp-pv.c: Likewise. * lib/canon-host.c: Likewise. * lib/canonicalize-lgpl.c: Likewise. * lib/float.in.h: Likewise. * lib/fstat.c: Likewise. * lib/getdelim.c: Likewise. * lib/getprogname.c: Likewise. * lib/glthread/thread.h: Likewise. * lib/intprops.h: Likewise. * lib/mbsrtowcs-state.c: Likewise. * lib/safe-read.c: Likewise. * lib/signal.in.h: Likewise. * lib/stat.c: Likewise. * lib/stdbool.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdio.in.h: Likewise. * lib/sysexits.in.h: Likewise. * lib/timespec.h: Likewise. * lib/wcsrtombs-state.c: Likewise. * m4/alloca.m4: Likewise. * m4/extern-inline.m4: Likewise. * m4/fstatat.m4: Likewise. * m4/gnulib-common.m4: Likewise. * m4/lib-ignore.m4: Likewise. * m4/printf.m4: Likewise. * m4/regex.m4: Likewise. * m4/stat-size.m4: Likewise. * m4/std-gnu11.m4: Likewise. * m4/stdbool.m4: Likewise. * m4/sys_types_h.m4: Likewise. * m4/threadlib.m4: Likewise. * m4/vararrays.m4: Likewise. * pygnulib/GLImport.py: Likewise. * tests/test-exp.h: Likewise. * tests/test-exp2.h: Likewise. * tests/test-expm1.h: Likewise. * tests/test-fflush2.c: Likewise. * tests/test-getopt_long.h: Likewise. * tests/test-intprops.c: Likewise. * tests/test-log.h: Likewise. * tests/test-log10.h: Likewise. * tests/test-log1p.h: Likewise. * tests/test-log2.h: Likewise. * tests/test-printf-posix.h: Likewise. * tests/test-regex.c: Likewise. * tests/test-snprintf-posix.h: Likewise. * tests/test-sprintf-posix.h: Likewise. * tests/test-stdalign.c: Likewise. * tests/test-stdbool.c: Likewise. * tests/test-vasnprintf-posix.c: Likewise. * tests/test-vasprintf-posix.c: Likewise. * top/maint.mk: Likewise.
Bruno Haible 03eac9d3 2017-09-14T00:35:56 all: Replace many more http URLs by https URLs. Update stale URLs. * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
Paul Eggert ca35d468 2017-09-13T00:48:18 all: prefer https: URLs
Paul Eggert a3fd683d 2017-01-01T02:59:23 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert 54615b95 2016-02-06T18:11:48 misc: port better to gcc -fsanitize=address Without these patches, ./configure CFLAGS='-fsanitize=address' would compute incorrect values. This patch fixes some (but not all) test failures with recent glibc, with this configuration. * m4/acl.m4 (gl_ACL_GET_FILE): * m4/calloc.m4 (_AC_FUNC_CALLOC_IF): * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): * m4/duplocale.m4 (gl_FUNC_DUPLOCALE): * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): * m4/getdelim.m4 (gl_FUNC_GETDELIM): * m4/getgroups.m4 (gl_FUNC_GETGROUPS): * m4/getline.m4 (gl_FUNC_GETLINE): * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): * m4/regex.m4 (gl_REGEX): * m4/strndup.m4 (gl_FUNC_STRNDUP): * tests/test-calloc-gnu.c (main): * tests/test-duplocale.c (main): * tests/test-getgroups.c (main): * tests/test-getline.c (main): * tests/test-inttostr.c (main): * tests/test-localename.c (test_locale_name) (test_locale_name_thread, test_locale_name_environ) (test_locale_name_default): * tests/test-regex.c (main): * tests/test-setlocale1.c (main): * tests/test-stat.h (test_stat_func): Free heap-allocated storage before exiting. * m4/asm-underscore.m4 (gl_ASM_SYMBOL_PREFIX): Don't match *_foo symbols inserted by AddressSanitizer. * tests/test-regex.c, tests/test-stat.c: Include stdlib.h, for 'free'.
Paul Eggert 71090a2a 2016-01-01T00:56:19 version-etc: new year * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
Paul Eggert b9bfe784 2015-01-01T01:38:23 version-etc: new year * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
Eric Blake 1276a2c5 2014-01-01T00:04:40 maint: update copyright I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
Dmitry V. Levin 92f3a4c8 2013-04-11T05:47:31 regex-tests, regex: allow glibc re_search behavior The data passed to re_search by the test for glibc bug 15078 is a multi-character collating element followed by a single character. According to POSIX, "It is unspecified whether a non-matching list expression matches a multi-character collating element that is not matched by any of the expressions." One of differences between glibc and gnulib implementations of re_search is that glibc re_search matches multi-character collating elements in that case while gnulib re_search doesn't. Since both re_search implementations conform to standard, change the test to allow glibc re_search behavior. * tests/test-regex.c (main): In test for glibc bug 15078, reformat re_search input data to make the multi-character collating element in it clearly visible, and treat re_search return code 0 as valid. * m4/regex.m4 (gl_REGEX): Likewise.
Eric Blake d69a4209 2013-03-12T15:15:01 regex-tests: skip UTF-8 test on mingw test-regex failed on mingw; and I traced it in gdb to an instance of init_dfa() setting dfa->is_utf8 to 0 in spite of setlocale() claiming success for "en_US.UTF-8". test-wcwidth already has precedent for skipping utf-8 tests where the system (or gnulib setlocale replacement, in this case) lies about utf-8 support. * modules/regex-tests (Depends-on): Add localcharset. * tests/test-regex.c (main): Use it to skip test on mingw. Signed-off-by: Eric Blake <eblake@redhat.com>
Eric Blake 6169015d 2013-03-11T14:51:33 regex: port to mingw's recent addition of undeclared alarm On mingw (at least, when cross-compiling with Fedora 18's mingw32-headers-2.0.999-0.15.trunk.20121110.fc18.noarch build), compilation of test-regex fails: test-regex.c: In function 'main': test-regex.c:42:11: error: 'SIGALRM' undeclared (first use in this function) test-regex.c:42:11: note: each undeclared identifier is reported only once for each function it appears in test-regex.c:43:3: warning: implicit declaration of function 'alarm' It turns out that recent mingw64 added an export of alarm() and SIGALRM, but guarded their declarations behind __USE_MINGW_ALARM (default off, and with alarm() only in the non-standard <io.h>); so the m4 tests were setting HAVE_ALARM to 1 based on link success but then failing to compile. * doc/posix-functions/alarm.texi (alarm): Document that alarm exists but still doesn't work in newer mingw. * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm declaration, not existence. Ensure SIGALRM is not trapped. * m4/mktime.m4 (gl_FUNC_MKTIME): Likewise. * m4/regex.m4 (gl_REGEX): Likewise. * m4/remainderf.m4 (gl_FUNC_REMAINDERF_WORKS): Likewise. * tests/test-regex.c (main): Use correct probe for alarm. Signed-off-by: Eric Blake <eblake@redhat.com>
Paul Eggert 6668cfa3 2013-02-03T09:19:06 regex-tests, regex: fix bug: memset undeclared * tests/test-regex.c: Don't include regex.h twice. Include string.h, to declare memset. Christensen's report also mentioned this issue. * m4/regex.m4 (gl_REGEX): Keep test program more in sync with test-regex.c, to avoid future problems like this. Remove AC_INCLUDES_DEFAULT. Include <string.h>. Don't include <regex.h> twice.
Paul Eggert 819b1c38 2013-01-31T21:07:02 regex-tests: new module * modules/regex-tests, tests/test-regex.c: New files.