[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r15193 - in /fsf/glibc-2_11-branch/libc: ./ libio/ posix/ sysdeps/posix/
- To: commits@xxxxxxxxxx
- Subject: [commits] r15193 - in /fsf/glibc-2_11-branch/libc: ./ libio/ posix/ sysdeps/posix/
- From: eglibc@xxxxxxxxxx
- Date: Mon, 05 Sep 2011 07:09:15 -0000
Author: eglibc
Date: Mon Sep 5 00:09:13 2011
New Revision: 15193
Log:
Import glibc-2.11 for 2011-09-05
Added:
fsf/glibc-2_11-branch/libc/posix/bug-regex32.c
Removed:
fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c
Modified:
fsf/glibc-2_11-branch/libc/ChangeLog
fsf/glibc-2_11-branch/libc/libio/Makefile
fsf/glibc-2_11-branch/libc/libio/fileops.c
fsf/glibc-2_11-branch/libc/posix/Makefile
fsf/glibc-2_11-branch/libc/posix/regex_internal.c
fsf/glibc-2_11-branch/libc/posix/regexec.c
fsf/glibc-2_11-branch/libc/sysdeps/posix/getaddrinfo.c
Modified: fsf/glibc-2_11-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/ChangeLog Mon Sep 5 00:09:13 2011
@@ -1,3 +1,29 @@
+2011-05-29 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12350]
+ * sysdeps/posix/getaddrinfo.c (gethosts): Restore only RES_USE_IENT6
+ bit from old_res_options.
+ (gaih_inet): Likewise.
+
+2011-05-28 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12811]
+ * posix/regex_internal.c (build_wcs_buffer): Don't signal we have to
+ grow the buffers more if it already has to be sufficient.
+ (build_wcs_upper_buffer): Likewise.
+ * posix/regexec.c (check_matching): Likewise.
+ (clean_state_log_if_needed): Likewise.
+ (extend_buffers): Don't enlarge buffers beyond size of the input
+ buffer.
+ Patches mostly by Emil Wojak <emil@xxxxxxxx>.
+ * posix/bug-regex32.c: New file.
+ * posix/Makefile (tests): Add bug-regex32.
+
+2011-05-14 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
+ storing incomplete byte sequence in state object.
+
2011-05-17 H.J. Lu <hongjiu.lu@xxxxxxxxx>
[BZ #12775]
@@ -27,14 +53,6 @@
* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
storing incomplete byte sequence in state object. Avoid testing for
guaranteed too small input if we know there is enough data available.
-
-2011-05-13 Ulrich Drepper <drepper@xxxxxxxxx>
-
- [BZ #12724]
- * libio/fileops.c (_IO_new_file_close_it): Always flush when
- currently writing and seek to current position when not.
- * libio/Makefile (tests): Add bug-fclose1.
- * libio/bug-fclose1.c: New file.
2011-05-12 Ulrich Drepper <drepper@xxxxxxxxx>
Modified: fsf/glibc-2_11-branch/libc/libio/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/libio/Makefile Mon Sep 5 00:09:13 2011
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2004,2006-2009,2011 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004,2006,2007,2008,2009 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -58,7 +58,7 @@
tst-memstream1 tst-memstream2 \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
- tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos bug-fclose1
+ tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
Removed: fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c (original)
+++ fsf/glibc-2_11-branch/libc/libio/bug-fclose1.c (removed)
@@ -1,132 +1,0 @@
-// BZ #12724
-
-static void do_prepare (void);
-#define PREPARE(argc, argv) do_prepare ()
-static int do_test (void);
-#define TEST_FUNCTION do_test()
-#include "../test-skeleton.c"
-
-
-static int fd;
-
-
-static void
-do_prepare (void)
-{
- fd = create_temp_file ("bug-fclose1.", NULL);
- if (fd == -1)
- {
- printf ("cannot create temporary file: %m\n");
- exit (1);
- }
-}
-
-
-static int
-do_test (void)
-{
- static const char pattern[] = "hello world";
-
- /* Prepare a seekable file. */
- if (write (fd, pattern, sizeof pattern) != sizeof pattern)
- {
- printf ("cannot write pattern: %m\n");
- return 1;
- }
- if (lseek (fd, 1, SEEK_SET) != 1)
- {
- printf ("cannot seek after write: %m\n");
- return 1;
- }
-
- /* Create an output stream visiting the file; when it is closed, all
- other file descriptors visiting the file must see the new file
- position. */
- int fd2 = dup (fd);
- if (fd2 < 0)
- {
- printf ("cannot duplicate descriptor for writing: %m\n");
- return 1;
- }
- FILE *f = fdopen (fd2, "w");
- if (f == NULL)
- {
- printf ("first fdopen failed: %m\n");
- return 1;
- }
- if (fputc (pattern[1], f) != pattern[1])
- {
- printf ("fputc failed: %m\n");
- return 1;
- }
- if (fclose (f) != 0)
- {
- printf ("first fclose failed: %m\n");
- return 1;
- }
- errno = 0;
- if (lseek (fd2, 0, SEEK_CUR) != -1)
- {
- printf ("lseek after fclose after write did not fail\n");
- return 1;
- }
- if (errno != EBADF)
- {
- printf ("lseek after fclose after write did not fail with EBADF: %m\n");
- return 1;
- }
- off_t o = lseek (fd, 0, SEEK_CUR);
- if (o != 2)
- {
- printf ("\
-lseek on original descriptor after first fclose returned %ld, expected 2\n",
- (long int) o);
- return 1;
- }
-
- /* Likewise for an input stream. */
- fd2 = dup (fd);
- if (fd2 < 0)
- {
- printf ("cannot duplicate descriptor for reading: %m\n");
- return 1;
- }
- f = fdopen (fd2, "r");
- if (f == NULL)
- {
- printf ("second fdopen failed: %m\n");
- return 1;
- }
- char c = fgetc (f);
- if (c != pattern[2])
- {
- printf ("getc returned %c, expected %c\n", c, pattern[2]);
- return 1;
- }
- if (fclose (f) != 0)
- {
- printf ("second fclose failed: %m\n");
- return 1;
- }
- errno = 0;
- if (lseek (fd2, 0, SEEK_CUR) != -1)
- {
- printf ("lseek after fclose after read did not fail\n");
- return 1;
- }
- if (errno != EBADF)
- {
- printf ("lseek after fclose after read did not fail with EBADF: %m\n");
- return 1;
- }
- o = lseek (fd, 0, SEEK_CUR);
- if (o != 3)
- {
- printf ("\
-lseek on original descriptor after second fclose returned %ld, expected 3\n",
- (long int) o);
- return 1;
- }
-
- return 0;
-}
Modified: fsf/glibc-2_11-branch/libc/libio/fileops.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/libio/fileops.c (original)
+++ fsf/glibc-2_11-branch/libc/libio/fileops.c Mon Sep 5 00:09:13 2011
@@ -160,27 +160,19 @@
_IO_new_file_close_it (fp)
_IO_FILE *fp;
{
+ int write_status, close_status;
if (!_IO_file_is_open (fp))
return EOF;
- int write_status;
- if (_IO_in_put_mode (fp))
+ if ((fp->_flags & _IO_NO_WRITES) == 0
+ && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0)
write_status = _IO_do_flush (fp);
- else if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
- && !_IO_in_backup (fp))
- {
- off64_t o = _IO_SEEKOFF (fp, 0, _IO_seek_cur, 0);
- if (o == WEOF)
- write_status = EOF;
- else
- write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
- }
else
write_status = 0;
INTUSE(_IO_unsave_markers) (fp);
- int close_status = _IO_SYSCLOSE (fp);
+ close_status = _IO_SYSCLOSE (fp);
/* Free buffer. */
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
Modified: fsf/glibc-2_11-branch/libc/posix/Makefile
==============================================================================
--- fsf/glibc-2_11-branch/libc/posix/Makefile (original)
+++ fsf/glibc-2_11-branch/libc/posix/Makefile Mon Sep 5 00:09:13 2011
@@ -82,7 +82,7 @@
bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
- bug-regex29 bug-regex30 bug-regex31 \
+ bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
tst-nice tst-nanosleep tst-regex2 \
transbug tst-rxspencer tst-pcre tst-boost \
bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
Added: fsf/glibc-2_11-branch/libc/posix/bug-regex32.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/posix/bug-regex32.c (added)
+++ fsf/glibc-2_11-branch/libc/posix/bug-regex32.c Mon Sep 5 00:09:13 2011
@@ -1,0 +1,36 @@
+// BZ 12811
+#include <regex.h>
+#include <stdio.h>
+#include <locale.h>
+
+static int
+do_test (void)
+{
+ char buf[1000];
+ regex_t preg;
+ if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
+ {
+ puts ("setlocale failed");
+ return 1;
+ }
+
+ int e = regcomp (&preg, ".*ab", REG_ICASE);
+ if (e != 0)
+ {
+ regerror (e, &preg, buf, sizeof (buf));
+ printf ("regcomp = %d \"%s\"\n", e, buf);
+ return 1;
+ }
+
+ // Incomplete character at the end of the buffer
+ e = regexec (&preg, "aaaaaaaaaaaa\xc4", 0, NULL, 0);
+
+ regfree (&preg);
+ regerror (e, &preg, buf, sizeof (buf));
+ printf ("regexec = %d \"%s\"\n", e, buf);
+
+ return e != REG_NOMATCH;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Modified: fsf/glibc-2_11-branch/libc/posix/regex_internal.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/posix/regex_internal.c (original)
+++ fsf/glibc-2_11-branch/libc/posix/regex_internal.c Mon Sep 5 00:09:13 2011
@@ -237,13 +237,8 @@
else
p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
- if (BE (mbclen == (size_t) -2, 0))
- {
- /* The buffer doesn't have enough space, finish to build. */
- pstr->cur_state = prev_st;
- break;
- }
- else if (BE (mbclen == (size_t) -1 || mbclen == 0, 0))
+ if (BE (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0))
{
/* We treat these cases as a singlebyte character. */
mbclen = 1;
@@ -251,6 +246,12 @@
if (BE (pstr->trans != NULL, 0))
wc = pstr->trans[wc];
pstr->cur_state = prev_st;
+ }
+ else if (BE (mbclen == (size_t) -2, 0))
+ {
+ /* The buffer doesn't have enough space, finish to build. */
+ pstr->cur_state = prev_st;
+ break;
}
/* Write wide character and padding. */
@@ -334,9 +335,11 @@
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
- else if (mbclen == (size_t) -1 || mbclen == 0)
+ else if (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
- /* It is an invalid character or '\0'. Just use the byte. */
+ /* It is an invalid character, an incomplete character
+ at the end of the string, or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
pstr->mbs[byte_idx] = ch;
/* And also cast it to wide char. */
@@ -449,7 +452,8 @@
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
- else if (mbclen == (size_t) -1 || mbclen == 0)
+ else if (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
/* It is an invalid character or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
Modified: fsf/glibc-2_11-branch/libc/posix/regexec.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/posix/regexec.c (original)
+++ fsf/glibc-2_11-branch/libc/posix/regexec.c Mon Sep 5 00:09:13 2011
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@xxxxxxxxxxxxxx>.
@@ -1134,12 +1134,13 @@
re_dfastate_t *old_state = cur_state;
int next_char_idx = re_string_cur_idx (&mctx->input) + 1;
- if (BE (next_char_idx >= mctx->input.bufs_len, 0)
- || (BE (next_char_idx >= mctx->input.valid_len, 0)
- && mctx->input.valid_len < mctx->input.len))
- {
- err = extend_buffers (mctx);
- if (BE (err != REG_NOERROR, 0))
+ if ((BE (next_char_idx >= mctx->input.bufs_len, 0)
+ && mctx->input.bufs_len < mctx->input.len)
+ || (BE (next_char_idx >= mctx->input.valid_len, 0)
+ && mctx->input.valid_len < mctx->input.len))
+ {
+ err = extend_buffers (mctx);
+ if (BE (err != REG_NOERROR, 0))
{
assert (err == REG_ESPACE);
return -2;
@@ -1710,7 +1711,8 @@
{
int top = mctx->state_log_top;
- if (next_state_log_idx >= mctx->input.bufs_len
+ if ((next_state_log_idx >= mctx->input.bufs_len
+ && mctx->input.bufs_len < mctx->input.len)
|| (next_state_log_idx >= mctx->input.valid_len
&& mctx->input.valid_len < mctx->input.len))
{
@@ -4074,7 +4076,7 @@
re_string_t *pstr = &mctx->input;
/* Double the lengthes of the buffers. */
- ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
+ ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
if (BE (ret != REG_NOERROR, 0))
return ret;
Modified: fsf/glibc-2_11-branch/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/posix/getaddrinfo.c Mon Sep 5 00:09:13 2011
@@ -207,7 +207,7 @@
if (herrno == NETDB_INTERNAL) \
{ \
__set_h_errno (herrno); \
- _res.options = old_res_options; \
+ _res.options |= old_res_options & RES_USE_INET6; \
return -EAI_SYSTEM; \
} \
if (herrno == TRY_AGAIN) \
@@ -842,7 +842,7 @@
nip = nip->next;
}
- _res.options = old_res_options;
+ _res.options |= old_res_options & RES_USE_INET6;
if (no_data != 0 && no_inet6_data != 0)
{