diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-06-16 18:43:46 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-06-16 18:43:46 +0300 |
commit | 52acc6d5ac3e4bf32924dc0819db19c654889436 (patch) | |
tree | 8d4eea9b82bcfdc4eeafbceed2206634ef3d4c89 | |
parent | 5ea6f531857cb61946456c2582f7eaa20ceba18b (diff) | |
download | gdbm-52acc6d5ac3e4bf32924dc0819db19c654889436.tar.gz gdbm-52acc6d5ac3e4bf32924dc0819db19c654889436.tar.bz2 |
Version 1.5v1.15
* configure.ac: Version 1.5
* NEWS: Update.
* src/Makefile.am (VI_CURRENT): Increment to 6
* src/bucket.c (_gdbm_get_bucket): Fix the upper limit for
bucket_bits.
* src/falloc.c (push_avail_block): Fill the allocated block
with 0s.
-rw-r--r-- | NEWS | 17 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/bucket.c | 4 | ||||
-rw-r--r-- | src/falloc.c | 2 | ||||
-rw-r--r-- | src/gdbmopen.c | 2 | ||||
-rw-r--r-- | src/gdbmsetopt.c | 2 | ||||
-rw-r--r-- | src/gdbmtool.c | 2 |
8 files changed, 21 insertions, 14 deletions
@@ -1,17 +1,24 @@ | |||
1 | GNU dbm NEWS -- history of user-visible changes. 2018-05-25 | 1 | GNU dbm NEWS -- history of user-visible changes. 2018-06-16 |
2 | Copyright (C) 1990-2018 Free Software Foundation, Inc. | 2 | Copyright (C) 1990-2018 Free Software Foundation, Inc. |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
5 | Please send gdbm bug reports to <bug-gdbm@gnu.org>. | 5 | Please send gdbm bug reports to <bug-gdbm@gnu.org>. |
6 | 6 | ||
7 | Version 1.14.90 | 7 | Version 1.15 - 2018-06-15 |
8 | 8 | ||
9 | FIXME: BUMP VI_MAJOR | 9 | * Extensive database consistency checking |
10 | 10 | ||
11 | * Implement database consistency checks | 11 | GDBM tries to detect inconsistencies in input database files as |
12 | early as possible. When an inconcistency is detected, a helpful | ||
13 | diagnostics is returned and the database is marked as needing | ||
14 | recovery. From this moment on, any GDBM function trying to access | ||
15 | the database will immediately return error code (instead of | ||
16 | eventually segfaulting as previous versions did). In order to | ||
17 | reconstruct the database and return it to healthy state, the | ||
18 | gdbm_recover function should be used. | ||
12 | 19 | ||
13 | Special thanks to Lionel Debroux and Craig Young for investing | 20 | Special thanks to Lionel Debroux and Craig Young for investing |
14 | their time and efforts in testing and providing valuable feedback. | 21 | their time and efforts in testing and providing valuable feedback. |
15 | 22 | ||
16 | * Improved error checking | 23 | * Improved error checking |
17 | 24 | ||
@@ -30,13 +37,13 @@ e.g.: | |||
30 | 37 | ||
31 | * Fixed data conversion bugs in storing structured keys or content | 38 | * Fixed data conversion bugs in storing structured keys or content |
32 | 39 | ||
33 | * New member in the gdbm_recovery structure: duplicate_keys. | 40 | * New member in the gdbm_recovery structure: duplicate_keys. |
34 | 41 | ||
35 | Upon return from gdbm_recover, this member holds the number of keys | 42 | Upon return from gdbm_recover, this member holds the number of keys |
36 | that were not recovered, because the same key has already been stored | 43 | that has not been recovered, because the same key had already been stored |
37 | in the database. The actual number of stored keys is thus | 44 | in the database. The actual number of stored keys is thus |
38 | recovered_keys - duplicate_keys. | 45 | recovered_keys - duplicate_keys. |
39 | 46 | ||
40 | * New error codes. | 47 | * New error codes. |
41 | 48 | ||
42 | GDBM_BAD_BUCKET "Malformed bucket header" | 49 | GDBM_BAD_BUCKET "Malformed bucket header" |
diff --git a/configure.ac b/configure.ac index 48ad675..505ba09 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -13,14 +13,14 @@ | |||
13 | # GNU General Public License for more details. | 13 | # GNU General Public License for more details. |
14 | # | 14 | # |
15 | # You should have received a copy of the GNU General Public License | 15 | # You should have received a copy of the GNU General Public License |
16 | # along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ | 16 | # along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ |
17 | 17 | ||
18 | m4_define([_GDBM_VERSION_MAJOR], 1) | 18 | m4_define([_GDBM_VERSION_MAJOR], 1) |
19 | m4_define([_GDBM_VERSION_MINOR], 14) | 19 | m4_define([_GDBM_VERSION_MINOR], 15) |
20 | m4_define([_GDBM_VERSION_PATCH], 90) | 20 | dnl m4_define([_GDBM_VERSION_PATCH], 0) |
21 | 21 | ||
22 | AC_INIT([gdbm], | 22 | AC_INIT([gdbm], |
23 | _GDBM_VERSION_MAJOR._GDBM_VERSION_MINOR[]m4_ifdef([_GDBM_VERSION_PATCH],._GDBM_VERSION_PATCH), | 23 | _GDBM_VERSION_MAJOR._GDBM_VERSION_MINOR[]m4_ifdef([_GDBM_VERSION_PATCH],._GDBM_VERSION_PATCH), |
24 | [bug-gdbm@gnu.org],, | 24 | [bug-gdbm@gnu.org],, |
25 | [http://www.gnu.org/software/gdbm]) | 25 | [http://www.gnu.org/software/gdbm]) |
26 | AC_PREREQ(2.69) | 26 | AC_PREREQ(2.69) |
diff --git a/src/Makefile.am b/src/Makefile.am index 0d2ca53..2710bf0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -30,13 +30,13 @@ noinst_HEADERS = \ | |||
30 | EXTRA_DIST = gdbm.h.in gdbm.magic | 30 | EXTRA_DIST = gdbm.h.in gdbm.magic |
31 | BUILT_SOURCES = gdbm.h gram.h | 31 | BUILT_SOURCES = gdbm.h gram.h |
32 | 32 | ||
33 | gram.h: gram.c | 33 | gram.h: gram.c |
34 | 34 | ||
35 | # The libraries | 35 | # The libraries |
36 | VI_CURRENT = 5 | 36 | VI_CURRENT = 6 |
37 | VI_REVISION = 0 | 37 | VI_REVISION = 0 |
38 | VI_AGE = 0 | 38 | VI_AGE = 0 |
39 | 39 | ||
40 | lib_LTLIBRARIES = libgdbm.la | 40 | lib_LTLIBRARIES = libgdbm.la |
41 | libgdbm_la_LIBADD = @LTLIBINTL@ | 41 | libgdbm_la_LIBADD = @LTLIBINTL@ |
42 | 42 | ||
diff --git a/src/bucket.c b/src/bucket.c index a3e8f4e..4b69bbe 100644 --- a/src/bucket.c +++ b/src/bucket.c | |||
@@ -26,13 +26,13 @@ | |||
26 | 26 | ||
27 | /* Initializing a new hash buckets sets all bucket entries to -1 hash value. */ | 27 | /* Initializing a new hash buckets sets all bucket entries to -1 hash value. */ |
28 | void | 28 | void |
29 | _gdbm_new_bucket (GDBM_FILE dbf, hash_bucket *bucket, int bits) | 29 | _gdbm_new_bucket (GDBM_FILE dbf, hash_bucket *bucket, int bits) |
30 | { | 30 | { |
31 | int index; | 31 | int index; |
32 | 32 | ||
33 | /* Initialize the avail block. */ | 33 | /* Initialize the avail block. */ |
34 | bucket->av_count = 0; | 34 | bucket->av_count = 0; |
35 | 35 | ||
36 | /* Set the information fields first. */ | 36 | /* Set the information fields first. */ |
37 | bucket->bucket_bits = bits; | 37 | bucket->bucket_bits = bits; |
38 | bucket->count = 0; | 38 | bucket->count = 0; |
@@ -143,13 +143,13 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index) | |||
143 | } | 143 | } |
144 | /* Validate the bucket */ | 144 | /* Validate the bucket */ |
145 | bucket = dbf->bucket_cache[lru].ca_bucket; | 145 | bucket = dbf->bucket_cache[lru].ca_bucket; |
146 | if (!(bucket->count >= 0 | 146 | if (!(bucket->count >= 0 |
147 | && bucket->count <= dbf->header->bucket_elems | 147 | && bucket->count <= dbf->header->bucket_elems |
148 | && bucket->bucket_bits >= 0 | 148 | && bucket->bucket_bits >= 0 |
149 | && bucket->bucket_bits <= GDBM_HASH_BITS)) | 149 | && bucket->bucket_bits <= dbf->header->dir_bits)) |
150 | { | 150 | { |
151 | GDBM_SET_ERRNO (dbf, GDBM_BAD_BUCKET, TRUE); | 151 | GDBM_SET_ERRNO (dbf, GDBM_BAD_BUCKET, TRUE); |
152 | return -1; | 152 | return -1; |
153 | } | 153 | } |
154 | /* Validate bucket_avail table */ | 154 | /* Validate bucket_avail table */ |
155 | if (gdbm_bucket_avail_table_validate (dbf, bucket)) | 155 | if (gdbm_bucket_avail_table_validate (dbf, bucket)) |
diff --git a/src/falloc.c b/src/falloc.c index 2f21ebe..6571d9b 100644 --- a/src/falloc.c +++ b/src/falloc.c | |||
@@ -289,13 +289,13 @@ push_avail_block (GDBM_FILE dbf) | |||
289 | &dbf->header->avail.count); | 289 | &dbf->header->avail.count); |
290 | if (new_loc.av_size == 0) | 290 | if (new_loc.av_size == 0) |
291 | new_loc = get_block (av_size, dbf); | 291 | new_loc = get_block (av_size, dbf); |
292 | av_adr = new_loc.av_adr; | 292 | av_adr = new_loc.av_adr; |
293 | 293 | ||
294 | /* Split the header block. */ | 294 | /* Split the header block. */ |
295 | temp = malloc (av_size); | 295 | temp = calloc (1, av_size); |
296 | if (temp == NULL) | 296 | if (temp == NULL) |
297 | { | 297 | { |
298 | GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); | 298 | GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); |
299 | _gdbm_fatal (dbf, _("malloc error")); | 299 | _gdbm_fatal (dbf, _("malloc error")); |
300 | return -1; | 300 | return -1; |
301 | } | 301 | } |
diff --git a/src/gdbmopen.c b/src/gdbmopen.c index 03cc4f4..677f1cf 100644 --- a/src/gdbmopen.c +++ b/src/gdbmopen.c | |||
@@ -151,13 +151,13 @@ validate_header (gdbm_file_header const *hdr, struct stat const *st) | |||
151 | if (!(hdr->dir_size >= dir_size)) | 151 | if (!(hdr->dir_size >= dir_size)) |
152 | return GDBM_BAD_HEADER; | 152 | return GDBM_BAD_HEADER; |
153 | compute_directory_size (hdr->dir_size, &dir_size, &dir_bits); | 153 | compute_directory_size (hdr->dir_size, &dir_size, &dir_bits); |
154 | if (hdr->dir_bits != dir_bits) | 154 | if (hdr->dir_bits != dir_bits) |
155 | return GDBM_BAD_HEADER; | 155 | return GDBM_BAD_HEADER; |
156 | 156 | ||
157 | if (!(hdr->bucket_size > 0 && hdr->bucket_size > sizeof(hash_bucket))) | 157 | if (!(hdr->bucket_size > sizeof(hash_bucket))) |
158 | return GDBM_BAD_HEADER; | 158 | return GDBM_BAD_HEADER; |
159 | 159 | ||
160 | if (hdr->bucket_elems != bucket_element_count (hdr->bucket_size)) | 160 | if (hdr->bucket_elems != bucket_element_count (hdr->bucket_size)) |
161 | return GDBM_BAD_HEADER; | 161 | return GDBM_BAD_HEADER; |
162 | 162 | ||
163 | if (((hdr->block_size - sizeof (gdbm_file_header)) / sizeof(avail_elem) + 1) | 163 | if (((hdr->block_size - sizeof (gdbm_file_header)) / sizeof(avail_elem) + 1) |
diff --git a/src/gdbmsetopt.c b/src/gdbmsetopt.c index f9face0..865f5a5 100644 --- a/src/gdbmsetopt.c +++ b/src/gdbmsetopt.c | |||
@@ -51,19 +51,19 @@ get_size (void *optval, int optlen, size_t *ret) | |||
51 | 51 | ||
52 | static int | 52 | static int |
53 | setopt_gdbm_setcachesize (GDBM_FILE dbf, void *optval, int optlen) | 53 | setopt_gdbm_setcachesize (GDBM_FILE dbf, void *optval, int optlen) |
54 | { | 54 | { |
55 | size_t sz; | 55 | size_t sz; |
56 | 56 | ||
57 | /* Optval will point to the new size of the cache. */ | ||
58 | if (dbf->bucket_cache != NULL) | 57 | if (dbf->bucket_cache != NULL) |
59 | { | 58 | { |
60 | GDBM_SET_ERRNO (dbf, GDBM_OPT_ALREADY_SET, FALSE); | 59 | GDBM_SET_ERRNO (dbf, GDBM_OPT_ALREADY_SET, FALSE); |
61 | return -1; | 60 | return -1; |
62 | } | 61 | } |
63 | 62 | ||
63 | /* Optval will point to the new size of the cache. */ | ||
64 | if (get_size (optval, optlen, &sz)) | 64 | if (get_size (optval, optlen, &sz)) |
65 | { | 65 | { |
66 | GDBM_SET_ERRNO (dbf, GDBM_OPT_ILLEGAL, FALSE); | 66 | GDBM_SET_ERRNO (dbf, GDBM_OPT_ILLEGAL, FALSE); |
67 | return -1; | 67 | return -1; |
68 | } | 68 | } |
69 | return _gdbm_init_cache (dbf, (sz > 9) ? sz : 10); | 69 | return _gdbm_init_cache (dbf, (sz > 9) ? sz : 10); |
diff --git a/src/gdbmtool.c b/src/gdbmtool.c index 6d56578..d0b2694 100644 --- a/src/gdbmtool.c +++ b/src/gdbmtool.c | |||
@@ -916,13 +916,13 @@ list_handler (struct handler_param *param) | |||
916 | { | 916 | { |
917 | datum nextkey = gdbm_nextkey (gdbm_file, key); | 917 | datum nextkey = gdbm_nextkey (gdbm_file, key); |
918 | 918 | ||
919 | data = gdbm_fetch (gdbm_file, key); | 919 | data = gdbm_fetch (gdbm_file, key); |
920 | if (!data.dptr) | 920 | if (!data.dptr) |
921 | { | 921 | { |
922 | terror (_("cannot fetch data; the key was:")); | 9 |