2003-11-25  Ulrich Drepper  <drepper@redhat.com>

	* posix/runptests.c (main): Make errors fatal.
	* posix/PTESTS: One test in GA135 and GA136 check functionality
	which seems not guaranteed.

2003-11-25  Jakub Jelinek  <jakub@redhat.com>

	* posix/regexec.c (re_search_internal): If prune_impossible_nodes
	returned REG_NOMATCH, set match_last to -1.  Don't initialize
	pmatch[0] needlessly.  Fix comment.
	(prune_impossible_nodes): Don't segfault on NULL state_log entry.
	(set_regs): Fix comment.
	* posix/regcomp.c (parse_bracket_exp): Only set has_plural_match
	if adding both SIMPLE_BRACKET and COMPLEX_BRACKET.
	(build_charclass_op): Set has_plural_match if adding both
	SIMPLE_BRACKET and COMPLEX_BRACKET.
	* posix/bug-regex11.c (tests): Fix register values for one commented
	out test.  Add new tests.

	* posix/regex_internal.c (re_string_allocate): Make sure init_len
	is at least dfa->mb_cur_max.
	(re_string_reconstruct): If is_utf8, don't fall back into
	re_string_skip_chars just because idx points into a middle of
	valid UTF-8 character.  Instead, set the wcs bytes which correspond
	to the partial character bytes to WEOF.
	* posix/regexec.c (re_search_internal): Allocate input.bufs_len + 1
	instead of dfa->nodes_len + 1 state_log entries initially.
	* posix/bug-regex20.c (main): Uncomment backwards case insensitive
	tests.
This commit is contained in:
Ulrich Drepper 2003-11-26 03:24:15 +00:00
parent 65e6becf5b
commit 97fd3a3003
19 changed files with 5570 additions and 5102 deletions

View File

@ -1,3 +1,34 @@
2003-11-25 Ulrich Drepper <drepper@redhat.com>
* posix/runptests.c (main): Make errors fatal.
* posix/PTESTS: One test in GA135 and GA136 check functionality
which seems not guaranteed.
2003-11-25 Jakub Jelinek <jakub@redhat.com>
* posix/regexec.c (re_search_internal): If prune_impossible_nodes
returned REG_NOMATCH, set match_last to -1. Don't initialize
pmatch[0] needlessly. Fix comment.
(prune_impossible_nodes): Don't segfault on NULL state_log entry.
(set_regs): Fix comment.
* posix/regcomp.c (parse_bracket_exp): Only set has_plural_match
if adding both SIMPLE_BRACKET and COMPLEX_BRACKET.
(build_charclass_op): Set has_plural_match if adding both
SIMPLE_BRACKET and COMPLEX_BRACKET.
* posix/bug-regex11.c (tests): Fix register values for one commented
out test. Add new tests.
* posix/regex_internal.c (re_string_allocate): Make sure init_len
is at least dfa->mb_cur_max.
(re_string_reconstruct): If is_utf8, don't fall back into
re_string_skip_chars just because idx points into a middle of
valid UTF-8 character. Instead, set the wcs bytes which correspond
to the partial character bytes to WEOF.
* posix/regexec.c (re_search_internal): Allocate input.bufs_len + 1
instead of dfa->nodes_len + 1 state_log entries initially.
* posix/bug-regex20.c (main): Uncomment backwards case insensitive
tests.
2003-11-24 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (re_token_t): Add word_char bit. Add

11
NEWS
View File

@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2003-4-24
GNU C Library NEWS -- history of user-visible changes. 2003-11-17
Copyright (C) 1992-2002,2003 Free Software Foundation, Inc.
See the end for copying conditions.
@ -18,6 +18,15 @@ Version 2.3.3
* getaddrinfo now implements AI_V4MAPPED, AI_ALL, and AI_ADDRCONF.
Implemented by Ulrich Drepper.
* support for non-executable stacks on x86 has been added. Changes mostly
by Roland McGrath.
* regex is now much faster for multibyte locaes. Changes by Jakub Jelinek
and Ulrich Drepper.
* getaddrinfo now performs destination address selection according to
RFC 3484.
Version 2.3.2

View File

@ -1096,7 +1096,8 @@ cannot allocate TLS data structures for initial thread");
prefer to map such objects at; but this is only a preference,
the OS can do whatever it likes. */
ElfW(Addr) mappref;
mappref = (ELF_PREFERRED_ADDRESS (loader, maplength, c->mapstart)
mappref = (ELF_PREFERRED_ADDRESS (loader, maplength,
c->mapstart & GL(dl_use_load_bias))
- MAP_BASE_ADDR (l));
/* Remember which part of the address space this object uses. */

View File

@ -41,6 +41,7 @@ size_t _dl_platformlen;
int _dl_debug_mask;
int _dl_lazy;
ElfW(Addr) _dl_use_load_bias = -2;
int _dl_dynamic_weak;
/* If nonzero print warnings about problematic situations. */

View File

@ -95,6 +95,7 @@ struct rtld_global _rtld_global =
._dl_sysinfo = DL_SYSINFO_DEFAULT,
#endif
._dl_lazy = 1,
._dl_use_load_bias = -2,
._dl_fpu_control = _FPU_DEFAULT,
._dl_correct_cache_id = _DL_CACHE_DEFAULT_ID,
._dl_hwcap_mask = HWCAP_IMPORTANT,
@ -996,6 +997,12 @@ of this helper program; chances are you did not intend to run this program.\n\
GL(dl_rtld_map).l_prev = GL(dl_loaded);
++GL(dl_nloaded);
/* If LD_USE_LOAD_BIAS env variable has not been seen, default
to not using bias for non-prelinked PIEs and libraries
and using it for executables or prelinked PIEs or libraries. */
if (GL(dl_use_load_bias) == (ElfW(Addr)) -2)
GL(dl_use_load_bias) = (GL(dl_loaded)->l_addr == 0) ? -1 : 0;
/* Set up the program header information for the dynamic linker
itself. It is needed in the dl_iterate_phdr() callbacks. */
ElfW(Ehdr) *rtld_ehdr = (ElfW(Ehdr) *) GL(dl_rtld_map).l_map_start;
@ -1992,6 +1999,17 @@ process_envvars (enum mode *modep)
GL(dl_dynamic_weak) = 1;
break;
case 13:
/* We might have some extra environment variable with length 13
to handle. */
#ifdef EXTRA_LD_ENVVARS_13
EXTRA_LD_ENVVARS_13
#endif
if (!INTUSE(__libc_enable_secure)
&& memcmp (envline, "USE_LOAD_BIAS", 13) == 0)
GL(dl_use_load_bias) = envline[14] == '1' ? -1 : 0;
break;
case 14:
/* Where to place the profiling data file. */
if (!INTUSE(__libc_enable_secure)

View File

@ -1626,6 +1626,7 @@ ceil_test (void)
TEST_f_f (ceil, M_PIl, 4.0);
TEST_f_f (ceil, -M_PIl, -3.0);
TEST_f_f (ceil, 0.25, 1.0);
TEST_f_f (ceil, -0.25, minus_zero);
END (ceil);
}
@ -2572,6 +2573,9 @@ floor_test (void)
TEST_f_f (floor, M_PIl, 3.0);
TEST_f_f (floor, -M_PIl, -4.0);
TEST_f_f (floor, 0.25, 0.0);
TEST_f_f (floor, -0.25, -1.0);
END (floor);
}

10495
po/ja.po

File diff suppressed because it is too large Load Diff

View File

@ -226,11 +226,18 @@
1¦20¦a\(.*b\)c¦axcaxbbbcsxbbbbbbbbc¦
# GA135
1¦7¦\(a\(b\(c\(d\(e\)\)\)\)\)\4¦abcdededede¦
1¦2¦a\(b\)*c\1¦acb¦
#W POSIX does not really specify whether a\(b\)*c\1 matches acb.
#W back references are supposed to expand to the last match, but what
#W if there never was a match as in this case?
-1¦-1¦a\(b\)*c\1¦acb¦
1¦11¦\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)\9¦abcdefghijjk¦
# GA136
1¦2¦a\(b\)*c\1¦acb¦
4¦7¦a\(b\(c\(d\(f\)*\)\)\)\4¦xYzabcdePQRST¦
#W These two tests have the same problem as the test in GA135. No match
#W of a subexpression, why should the back reference be usable?
#W 1 2 a\(b\)*c\1 acb
#W 4 7 a\(b\(c\(d\(f\)*\)\)\)\4¦xYzabcdePQRST
-1¦-1¦a\(b\)*c\1¦acb¦
-1¦-1¦a\(b\(c\(d\(f\)*\)\)\)\4¦xYzabcdePQRST¦
# GA137
-2¦-2¦\(a\(b\)\)\3¦foo¦
-2¦-2¦\(a\(b\)\)\(a\(b\)\)\5¦foo¦

View File

@ -54,13 +54,22 @@ struct
{ "(^|foo)bar", "(^|foo)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
{ "(foo|^)bar", "(foo|^)bar", 0, 2, { { 0, 10 }, { -1, -1 } } },
/* More tests on backreferences. */
{ "()\\1", "x", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } },
{ "()x\\1", "x", REG_EXTENDED, 2, { { 0, 1 }, { 0, 0 } } },
{ "()\\1*\\1*", "", REG_EXTENDED, 2, { { 0, 0 }, { 0, 0 } } },
{ "([0-9]).*\\1(a*)", "7;7a6", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
{ "([0-9]).*\\1(a*)", "7;7a", REG_EXTENDED, 3, { { 0, 4 }, { 0, 1 }, { 3, 4 } } },
{ "(b)()c\\1", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 1 }, { 1, 1 } } },
{ "()(b)c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } },
{ "a(b)()c\\1", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 2 }, { 2, 2 } } },
{ "a()(b)c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } },
#if 0
/* XXX Not used since they fail so far. */
{ "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 1, 2 } } },
{ "()(b)\\1c\\2", "bcb", REG_EXTENDED, 3, { { 0, 3 }, { 0, 0 }, { 0, 1 } } },
{ "(b())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 2 }, { 0, 1 }, { 1, 1 } } },
{ "a()(b)\\1c\\2", "abcb", REG_EXTENDED, 3, { { 0, 4 }, { 1, 1 }, { 1, 2 } } },
{ "a()d(b)\\1c\\2", "adbcb", REG_EXTENDED, 3, { { 0, 5 }, { 1, 1 }, { 2, 3 } } },
{ "a(b())\\2\\1", "abbbb", REG_EXTENDED, 3, { { 0, 3 }, { 1, 2 }, { 2, 2 } } },
{ "(bb())\\2\\1", "bbbb", REG_EXTENDED, 3, { { 0, 4 }, { 0, 2 }, { 2, 2 } } },
{ "^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\\9\\8\\7\\6\\5\\4\\3\\2\\1$",
"level", REG_NOSUB | REG_EXTENDED, 0, { { -1, -1 } } },

View File

@ -271,7 +271,6 @@ main (void)
continue;
}
/* XXX: This causes regex segfault. Disable for now.
res = re_search (&regbuf, tests[i].string, str_len, str_len, -str_len,
NULL);
if (res != tests[i].res)
@ -280,7 +279,7 @@ main (void)
ret = 1;
regfree (&regbuf);
continue;
} */
}
regfree (&regbuf);
}

View File

@ -221,11 +221,18 @@
{ 1, 20, "a\\(.*b\\)c", "axcaxbbbcsxbbbbbbbbc", },
{ 0, 0, "GA135", NULL, },
{ 1, 7, "\\(a\\(b\\(c\\(d\\(e\\)\\)\\)\\)\\)\\4", "abcdededede", },
{ 1, 2, "a\\(b\\)*c\\1", "acb", },
{ 0, 0, NULL, "POSIX does not really specify whether a\\(b\\)*c\\1 matches acb." },
{ 0, 0, NULL, "back references are supposed to expand to the last match, but what" },
{ 0, 0, NULL, "if there never was a match as in this case?" },
{ -1, -1, "a\\(b\\)*c\\1", "acb", },
{ 1, 11, "\\(a\\(b\\(c\\(d\\(e\\(f\\(g\\)h\\(i\\(j\\)\\)\\)\\)\\)\\)\\)\\)\\9", "abcdefghijjk", },
{ 0, 0, "GA136", NULL, },
{ 1, 2, "a\\(b\\)*c\\1", "acb", },
{ 4, 7, "a\\(b\\(c\\(d\\(f\\)*\\)\\)\\)\\4", "xYzabcdePQRST", },
{ 0, 0, NULL, "These two tests have the same problem as the test in GA135. No match" },
{ 0, 0, NULL, "of a subexpression, why should the back reference be usable?" },
{ 0, 0, NULL, "1 2 a\\(b\\)*c\\1 acb" },
{ 0, 0, NULL, "4 7 a\\(b\\(c\\(d\\(f\\)*\\)\\)\\)\\4¦xYzabcdePQRST" },
{ -1, -1, "a\\(b\\)*c\\1", "acb", },
{ -1, -1, "a\\(b\\(c\\(d\\(f\\)*\\)\\)\\)\\4", "xYzabcdePQRST", },
{ 0, 0, "GA137", NULL, },
{ -2, -2, "\\(a\\(b\\)\\)\\3", "foo", },
{ -2, -2, "\\(a\\(b\\)\\)\\(a\\(b\\)\\)\\5", "foo", },

View File

@ -3213,7 +3213,6 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
int sbc_idx;
/* Build a tree for complex bracket. */
dfa->has_mb_node = 1;
dfa->has_plural_match = 1;
for (sbc_idx = 0; sbc_idx < BITSET_UINTS; ++sbc_idx)
if (sbcset[sbc_idx])
break;
@ -3233,6 +3232,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err)
goto parse_bracket_exp_espace;
/* Then join them by ALT node. */
alt_token.type = OP_ALT;
dfa->has_plural_match = 1;
work_tree = re_dfa_add_tree_node (dfa, work_tree, mbc_tree, &alt_token);
if (BE (mbc_tree != NULL, 1))
return work_tree;
@ -3627,6 +3627,7 @@ build_charclass_op (dfa, trans, class_name, extra, not, err)
goto build_word_op_espace;
/* Then join them by ALT node. */
alt_token.type = OP_ALT;
dfa->has_plural_match = 1;
tree = re_dfa_add_tree_node (dfa, tree, mbc_tree, &alt_token);
if (BE (mbc_tree != NULL, 1))
return tree;

View File

@ -55,7 +55,12 @@ re_string_allocate (pstr, str, len, init_len, trans, icase, dfa)
const re_dfa_t *dfa;
{
reg_errcode_t ret;
int init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
int init_buf_len;
/* Ensure at least one character fits into the buffers. */
if (init_len < dfa->mb_cur_max)
init_len = dfa->mb_cur_max;
init_buf_len = (len + 1 < init_len) ? len + 1: init_len;
re_string_construct_common (str, len, pstr, trans, icase, dfa);
pstr->stop = pstr->len;
@ -516,33 +521,33 @@ re_string_reconstruct (pstr, idx, eflags, newline)
/* Special case UTF-8. Multi-byte chars start with any
byte other than 0x80 - 0xbf. */
raw = pstr->raw_mbs + pstr->raw_mbs_idx;
end = raw + (pstr->valid_len > offset - pstr->mb_cur_max
? pstr->valid_len : offset - pstr->mb_cur_max);
end = raw + (offset - pstr->mb_cur_max);
for (p = raw + offset - 1; p >= end; --p)
if ((*p & 0xc0) != 0x80)
{
mbstate_t cur_state;
wchar_t wc2;
int mlen;
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
if (mbrtowc (&wc2, p, raw + offset - p, &cur_state)
== raw + offset - p)
mlen = mbrtowc (&wc2, p, raw + pstr->len - p,
&cur_state) - (raw + offset - p);
if (mlen >= 0)
{
memset (&pstr->cur_state, '\0',
sizeof (mbstate_t));
pstr->valid_len = mlen;
wc = wc2;
}
break;
}
}
if (wc == WEOF)
{
pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx;
for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx)
pstr->wcs[wcs_idx] = WEOF;
}
pstr->valid_len = re_string_skip_chars (pstr, idx, &wc) - idx;
for (wcs_idx = 0; wcs_idx < pstr->valid_len; ++wcs_idx)
pstr->wcs[wcs_idx] = WEOF;
if (pstr->trans && wc <= 0xff)
wc = pstr->trans[wc];
pstr->tip_context = (IS_WIDE_WORD_CHAR (wc) ? CONTEXT_WORD

View File

@ -620,7 +620,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
multi character collating element. */
if (nmatch > 1 || dfa->has_mb_node)
{
mctx.state_log = re_malloc (re_dfastate_t *, dfa->nodes_len + 1);
mctx.state_log = re_malloc (re_dfastate_t *, input.bufs_len + 1);
if (BE (mctx.state_log == NULL, 0))
{
err = REG_ESPACE;
@ -766,6 +766,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
break;
if (BE (err != REG_NOMATCH, 0))
goto free_return;
match_last = -1;
}
else
break; /* We found a match. */
@ -785,7 +786,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
int reg_idx;
/* Initialize registers. */
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
for (reg_idx = 1; reg_idx < nmatch; ++reg_idx)
pmatch[reg_idx].rm_so = pmatch[reg_idx].rm_eo = -1;
/* Set the points where matching start/end. */
@ -801,7 +802,8 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
}
/* At last, add the offset to the each registers, since we slided
the buffers so that We can assume that the matching starts from 0. */
the buffers so that we could assume that the matching starts
from 0. */
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
if (pmatch[reg_idx].rm_so != -1)
{
@ -869,7 +871,8 @@ prune_impossible_nodes (preg, mctx)
ret = REG_NOMATCH;
goto free_return;
}
} while (!mctx->state_log[match_last]->halt);
} while (mctx->state_log[match_last] == NULL
|| !mctx->state_log[match_last]->halt);
halt_node = check_halt_state_context (preg,
mctx->state_log[match_last],
mctx, match_last);
@ -1236,7 +1239,7 @@ pop_fail_stack (fs, pidx, nregs, regs, eps_via_nodes)
/* Set the positions where the subexpressions are starts/ends to registers
PMATCH.
Note: We assume that pmatch[0] is already set, and
pmatch[i].rm_so == pmatch[i].rm_eo == -1 (i > 1). */
pmatch[i].rm_so == pmatch[i].rm_eo == -1 for 0 < i < nmatch. */
static reg_errcode_t
set_regs (preg, mctx, nmatch, pmatch, fl_backtrack)

View File

@ -119,8 +119,5 @@ main (int argc, char *argv[])
printf ("\n%Zu tests, %d errors\n", cnt, errors);
/* We should return here the error status but since some tests are known
to fail this would only cause the libc testsuite to fail. */
//return errors != 0;
return 0;
return errors != 0;
}

View File

@ -337,6 +337,11 @@ struct rtld_global
/* File descriptor to write debug messages to. */
EXTERN int _dl_debug_fd;
/* -1 if the dynamic linker should honor library load bias,
0 if not, -2 use the default (honor biases for normal
binaries, don't honor for PIEs). */
EXTERN ElfW(Addr) _dl_use_load_bias;
#ifdef _LIBC_REENTRANT
EXTERN void **(*_dl_error_catch_tsd) (void) __attribute__ ((const));
#endif

View File

@ -7,6 +7,7 @@
"LD_ORIGIN_PATH\0" \
"LD_DEBUG_OUTPUT\0" \
"LD_PROFILE\0" \
"LD_USE_LOAD_BIAS\0" \
"GCONV_PATH\0" \
"HOSTALIASES\0" \
"LOCALDOMAIN\0" \

View File

@ -1,5 +1,5 @@
/* Optional code to distinguish library flavours.
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
@ -44,12 +44,12 @@ _dl_osversion_init (char *assume_kernel)
}
/* Recognizing extra environment variables. */
#define EXTRA_LD_ENVVARS EXTRA_LD_ENVVARS_LINUX
#define EXTRA_LD_ENVVARS_LINUX \
case 13: \
#define EXTRA_LD_ENVVARS_13 \
if (memcmp (envline, "ASSUME_KERNEL", 13) == 0) \
_dl_osversion_init (&envline[14]); \
break; \
{ \
_dl_osversion_init (&envline[14]); \
break; \
}
#define DL_OSVERSION_INIT \
do { \

View File

@ -1,5 +1,5 @@
/* Optional code to distinguish library flavours.
Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
Copyright (C) 1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@ -48,8 +48,7 @@
while (0)
/* Recognizing extra environment variables. */
#undef EXTRA_LD_ENVVARS
#define EXTRA_LD_ENVVARS EXTRA_LD_ENVVARS_LINUX \
#define EXTRA_LD_ENVVARS \
case 15: \
if (memcmp (envline, "LIBRARY_VERSION", 15) == 0) \
GL(dl_correct_cache_id) = envline[16] == '5' ? 2 : 3; \