Re: hash table allocation failure

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 6/15/2009 9:25 PM:
> Thanks to Jim's recent work on the gnulib hash module, I audited the code
> for cases where allocation failure could cause assertion failures instead
> of expected xalloc_die behavior (either way, the program ends, but I want
> it to be obvious from the stderr output that the user was short on memory,
> and not that they triggered an internal error in m4).  I have a pending
> patch that aims to clean up a memory leak in gnulib's hash_rehash
> (admittedly a corner case, since there's not much you can do to recover
> from an allocation failure on a rehash); but until that is reviewed and
> applied, I'm using a gnulib local override to avoid a gcc warning.  Only
> branch-1.6 is affected.

Now that gnulib memory handling bugs are fixed, I'm committing this followup:

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko9UkkACgkQ84KuGfSFAYBwFgCdGOAgqsqaLAp+WyVPoz62+OlO
gDMAoKJTX0jaPptxZ8AvDlt0mMJ75TKM
=sGMr
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch424 (text/plain, 2 KB)
From 58b5bd6df6ab813378990f05f8d5487b6243f8c1 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Sat, 20 Jun 2009 15:17:01 -0600
Subject: [PATCH] Update gnulib for hash fixes.

* gnulib: Update to latest.
* local/lib/hash.c.diff: No longer necessary.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog             |    6 ++++++
 gnulib                |    2 +-
 local/lib/hash.c.diff |   27 ---------------------------
 3 files changed, 7 insertions(+), 28 deletions(-)
 delete mode 100644 local/lib/hash.c.diff

diff --git a/ChangeLog b/ChangeLog
index 3ffb880..38c2484 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-20  Eric Blake  <[email protected]>
+
+	Update gnulib for hash fixes.
+	* gnulib: Update to latest.
+	* local/lib/hash.c.diff: No longer necessary.
+
 2009-06-17  Eric Blake  <[email protected]>

 	Fix typo in last patch.
diff --git a/gnulib b/gnulib
index 7cf183c..12f78b4 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 7cf183c33ef0c792b5c93dbb4ac5b7858ee03986
+Subproject commit 12f78b4faa14cd2da952f865979843dee79fcf93
diff --git a/local/lib/hash.c.diff b/local/lib/hash.c.diff
deleted file mode 100644
index 8d27a36..0000000
--- a/local/lib/hash.c.diff
+++ /dev/null
@@ -1,27 +0,0 @@
-diff --git a/lib/hash.c b/lib/hash.c
-index 7d76d45..6f3a5c6 100644
---- a/lib/hash.c
-+++ b/lib/hash.c
-@@ -1,7 +1,7 @@
- /* hash - hashing table processing.
-
--   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free
--   Software Foundation, Inc.
-+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
-+   2009 Free Software Foundation, Inc.
-
-    Written by Jim Meyering, 1992.
-
-@@ -1012,7 +1012,11 @@ hash_delete (Hash_table *table, const void *entry)
- 		 : (table->n_buckets * tuning->shrink_factor
- 		    * tuning->growth_threshold));
-
--	      hash_rehash (table, candidate);
-+	      if (hash_rehash (table, candidate))
-+		{
-+		  /* Failure to allocate memory in an attempt to
-+		     shrink the table is not fatal.  */
-+		}
- 	    }
- 	}
-     }
-- 
1.6.3.rc3.2.g4b51
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.