This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, release/2.11/master, updated. glibc-2.11.3-67-gdf79688


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.11/master has been updated
       via  df79688ef6f6c746ecb4cc2e212780832e2f9c87 (commit)
       via  07c65bd7b3f8aaed2e6e567d4b1a932893e8838a (commit)
       via  36edecaa99bfe160463da7df4b5810726be3eb53 (commit)
       via  cf65c66723866e18be77c7676fde66deafd4d126 (commit)
      from  81313e32ef1885c1cb884042398b299df11f3e3c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=df79688ef6f6c746ecb4cc2e212780832e2f9c87

commit df79688ef6f6c746ecb4cc2e212780832e2f9c87
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sun May 29 23:49:49 2011 -0400

    Restore _res correctly
    
    getaddrinfo works around the resolver functionality to avoid automatic
    IPv6 lookups.  The restoring didn't allow for the resolver to set
    additional bits in _res.
    
    (cherry picked from commit 7ae22829afb2b4ca531d1c00437d428f55d59341)

diff --git a/ChangeLog b/ChangeLog
index da762ca..2e9a516 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-29  Ulrich Drepper  <drepper@gmail.com>
+
+	[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@gmail.com>
 
 	[BZ #12811]
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 0217cc6..923d6c8 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -207,7 +207,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
       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 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		nip = nip->next;
 	    }
 
-	  _res.options = old_res_options;
+	  _res.options |= old_res_options & RES_USE_INET6;
 
 	  if (no_data != 0 && no_inet6_data != 0)
 	    {

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=07c65bd7b3f8aaed2e6e567d4b1a932893e8838a

commit 07c65bd7b3f8aaed2e6e567d4b1a932893e8838a
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sat May 28 17:14:30 2011 -0400

    Fix unnecessary overallocation due to incomplete character
    
    When incomplete characters are found at the end of a string the
    code ran amok and allocated lots of memory.  Stricter limits
    are now in place.
    
    (cherry picked from commit 8887a920a4b81a500f54893250085e0d1a52cf9a)

diff --git a/ChangeLog b/ChangeLog
index da84df3..da762ca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-05-28  Ulrich Drepper  <drepper@gmail.com>
+
+	[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@wojak.eu>.
+	* posix/bug-regex32.c: New file.
+	* posix/Makefile (tests): Add bug-regex32.
+
 2011-05-14  Ulrich Drepper  <drepper@gmail.com>
 
 	* iconv/loop.c (SINGLE) [STORE_REST]: Add input bytes to bytebuf before
diff --git a/posix/Makefile b/posix/Makefile
index 4c9ff85..df8fc47 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -82,7 +82,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   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 \
diff --git a/posix/bug-regex32.c b/posix/bug-regex32.c
new file mode 100644
index 0000000..525232c
--- /dev/null
+++ b/posix/bug-regex32.c
@@ -0,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"
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 09cffcf..6e75f47 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -237,13 +237,8 @@ build_wcs_buffer (re_string_t *pstr)
       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;
@@ -252,6 +247,12 @@ build_wcs_buffer (re_string_t *pstr)
 	    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.  */
       pstr->wcs[byte_idx++] = wc;
@@ -334,9 +335,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
 	      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 @@ build_wcs_upper_buffer (re_string_t *pstr)
 	    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];
diff --git a/posix/regexec.c b/posix/regexec.c
index 5019003..756682e 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -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@yamato.ibm.com>.
 
@@ -1134,12 +1134,13 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
       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 @@ clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx)
 {
   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 @@ extend_buffers (re_match_context_t *mctx)
   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;
 

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=36edecaa99bfe160463da7df4b5810726be3eb53

commit 36edecaa99bfe160463da7df4b5810726be3eb53
Author: Petr Baudis <pasky@ucw.cz>
Date:   Sat Sep 3 19:53:53 2011 +0200

    Revert "Fix file descriptor position after fclose"
    
    This reverts commit 82c938203add9de265744987c8f1efa454d80461.

diff --git a/ChangeLog b/ChangeLog
index e3cc9bf..da84df3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,14 +33,6 @@
 	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@gmail.com>
-
-	[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@gmail.com>
 
 	[BZ #12511]
diff --git a/libio/Makefile b/libio/Makefile
index ec30904..83b9458 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -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 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
 	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.
diff --git a/libio/bug-fclose1.c b/libio/bug-fclose1.c
deleted file mode 100644
index f1e09f5..0000000
--- a/libio/bug-fclose1.c
+++ /dev/null
@@ -1,132 +0,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;
-}
diff --git a/libio/fileops.c b/libio/fileops.c
index adf4cfa..1e7ef07 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -160,25 +160,19 @@ int
 _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

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=cf65c66723866e18be77c7676fde66deafd4d126

commit cf65c66723866e18be77c7676fde66deafd4d126
Author: Petr Baudis <pasky@ucw.cz>
Date:   Sat Sep 3 19:53:42 2011 +0200

    Revert "Initialize variable in _IO_new_file_close_it"
    
    This reverts commit 875703d0957adb972d542cfd174dba9bb95e8321.
    
    Conflicts:
    
    	ChangeLog

diff --git a/ChangeLog b/ChangeLog
index d05deb4..e3cc9bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-14  Ulrich Drepper  <drepper@gmail.com>
+
+	* 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@intel.com>
 
 	[BZ #12775]
diff --git a/libio/fileops.c b/libio/fileops.c
index 66c17df..adf4cfa 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -175,8 +175,6 @@ _IO_new_file_close_it (fp)
       else
 	write_status = _IO_SYSSEEK (fp, o, SEEK_SET) < 0 ? EOF : 0;
     }
-  else
-    write_status = 0;
 
   INTUSE(_IO_unsave_markers) (fp);
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |   34 +++++++++---
 libio/Makefile              |    4 +-
 libio/bug-fclose1.c         |  132 -------------------------------------------
 libio/fileops.c             |   16 +----
 posix/Makefile              |    2 +-
 posix/bug-regex32.c         |   36 ++++++++++++
 posix/regex_internal.c      |   24 +++++---
 posix/regexec.c             |   20 ++++---
 sysdeps/posix/getaddrinfo.c |    4 +-
 9 files changed, 96 insertions(+), 176 deletions(-)
 delete mode 100644 libio/bug-fclose1.c
 create mode 100644 posix/bug-regex32.c


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]