Updated to new upstream release 1.10

Dropped -shortread patch, which has been already applied by upstream
Disable large file support, that is enabled by default since 1.9,
but not compatible with db files created using gdbm-1.8.3 and lower
License change to GPLv3+
Add doc files THANKS AUTHORS NOTE-WARNING
Changed text in NOTE-WARNING to correspond with build settings
This commit is contained in:
Honza Horák 2011-11-14 18:24:44 +01:00
parent 6fa8481e33
commit d7a18d918c
5 changed files with 38 additions and 142 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
gdbm-1.8.3.tar.gz
/gdbm-1.9.1.tar.gz
/gdbm-1.10.tar.gz

View File

@ -1,28 +1,19 @@
diff -up gdbm-1.9.1/src/falloc.c.zeroheaders gdbm-1.9.1/src/falloc.c
--- gdbm-1.9.1/src/falloc.c.zeroheaders 2011-08-03 21:22:23.000000000 +0200
+++ gdbm-1.9.1/src/falloc.c 2011-08-24 18:23:16.876903878 +0200
diff -up gdbm-1.10/src/falloc.c.zeroheaders gdbm-1.10/src/falloc.c
--- gdbm-1.10/src/falloc.c.zeroheaders 2011-11-11 11:59:11.000000000 +0100
+++ gdbm-1.10/src/falloc.c 2011-11-14 17:34:32.487604027 +0100
@@ -255,7 +255,7 @@ push_avail_block (GDBM_FILE dbf)
/* Split the header block. */
- temp = (avail_block *) malloc (av_size);
+ temp = (avail_block *) calloc (1, av_size);
if (temp == NULL) _gdbm_fatal (dbf, "malloc error");
if (temp == NULL) _gdbm_fatal (dbf, _("malloc error"));
/* Set the size to be correct AFTER the pop_avail_block. */
temp->size = dbf->header->avail.size;
diff -up gdbm-1.9.1/src/gdbmopen.c.zeroheaders gdbm-1.9.1/src/gdbmopen.c
--- gdbm-1.9.1/src/gdbmopen.c.zeroheaders 2011-08-12 22:22:52.000000000 +0200
+++ gdbm-1.9.1/src/gdbmopen.c 2011-08-24 18:23:16.877903878 +0200
@@ -204,7 +204,7 @@ gdbm_open (const char *file, int block_s
file_block_size = block_size;
/* Get space for the file header. */
- dbf->header = (gdbm_file_header *) malloc (file_block_size);
+ dbf->header = (gdbm_file_header *) calloc (1, file_block_size);
if (dbf->header == NULL)
{
gdbm_close (dbf);
@@ -248,7 +248,7 @@ gdbm_open (const char *file, int block_s
diff -up gdbm-1.10/src/gdbmopen.c.zeroheaders gdbm-1.10/src/gdbmopen.c
--- gdbm-1.10/src/gdbmopen.c.zeroheaders 2011-11-11 19:39:42.000000000 +0100
+++ gdbm-1.10/src/gdbmopen.c 2011-11-14 17:33:24.867608650 +0100
@@ -264,7 +264,7 @@ gdbm_open (const char *file, int block_s
(dbf->header->block_size - sizeof (hash_bucket))
/ sizeof (bucket_element) + 1;
dbf->header->bucket_size = dbf->header->block_size;
@ -31,7 +22,7 @@ diff -up gdbm-1.9.1/src/gdbmopen.c.zeroheaders gdbm-1.9.1/src/gdbmopen.c
if (dbf->bucket == NULL)
{
gdbm_close (dbf);
@@ -440,7 +440,7 @@ _gdbm_init_cache(GDBM_FILE dbf, size_t s
@@ -456,7 +456,7 @@ _gdbm_init_cache(GDBM_FILE dbf, size_t s
for(index = 0; index < size; index++)
{
(dbf->bucket_cache[index]).ca_bucket

View File

@ -1,111 +0,0 @@
diff -up gdbm-1.9.1/src/bucket.c.shortread gdbm-1.9.1/src/bucket.c
--- gdbm-1.9.1/src/bucket.c.shortread 2011-08-03 21:22:23.000000000 +0200
+++ gdbm-1.9.1/src/bucket.c 2011-08-24 18:34:39.501857203 +0200
@@ -21,7 +21,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-
+#include <errno.h>
/* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
void
@@ -53,7 +53,8 @@ void
_gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
{
off_t bucket_adr; /* The address of the correct hash bucket. */
- int num_bytes; /* The number of bytes read. */
+ int num_bytes = 0; /* The total number of bytes read. */
+ int bytes_read; /* Number of bytes read in this syscall */
off_t file_pos; /* The return address for lseek. */
int index; /* Loop index. */
@@ -96,7 +97,12 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir
if (file_pos != bucket_adr)
_gdbm_fatal (dbf, "lseek error");
- num_bytes = __read (dbf, dbf->bucket, dbf->header->bucket_size);
+ do
+ {
+ bytes_read = __read (dbf, dbf->bucket+num_bytes, dbf->header->bucket_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < dbf->header->bucket_size);
if (num_bytes != dbf->header->bucket_size)
_gdbm_fatal (dbf, "read error");
}
diff -up gdbm-1.9.1/src/falloc.c.shortread gdbm-1.9.1/src/falloc.c
--- gdbm-1.9.1/src/falloc.c.shortread 2011-08-24 18:23:16.876903878 +0200
+++ gdbm-1.9.1/src/falloc.c 2011-08-24 18:36:15.877850610 +0200
@@ -21,7 +21,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-
+#include <errno.h>
/* The forward definitions for this file. See the functions for
the definition of the function. */
@@ -158,7 +158,8 @@ _gdbm_free (GDBM_FILE dbf, off_t file_ad
static void
pop_avail_block (GDBM_FILE dbf)
{
- int num_bytes; /* For use with the read system call. */
+ int num_bytes = 0; /* For use with the read system call. */
+ int bytes_read; /* For use with the read system call. */
off_t file_pos; /* For use with the lseek system call. */
avail_elem new_el;
avail_block *new_blk;
@@ -183,7 +184,12 @@ pop_avail_block (GDBM_FILE dbf)
/* Read the block. */
file_pos = __lseek (dbf, new_el.av_adr, L_SET);
if (file_pos != new_el.av_adr) _gdbm_fatal (dbf, "lseek error");
- num_bytes = __read (dbf, new_blk, new_el.av_size);
+ do
+ {
+ bytes_read = __read (dbf, new_blk+num_bytes, new_el.av_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < new_el.av_size);
if (num_bytes != new_el.av_size) _gdbm_fatal (dbf, "read error");
/* Add the elements from the new block to the header. */
diff -up gdbm-1.9.1/src/findkey.c.shortread gdbm-1.9.1/src/findkey.c
--- gdbm-1.9.1/src/findkey.c.shortread 2011-08-03 21:22:23.000000000 +0200
+++ gdbm-1.9.1/src/findkey.c 2011-08-24 18:37:00.591847528 +0200
@@ -21,6 +21,7 @@
#include "autoconf.h"
#include "gdbmdefs.h"
+#include <errno.h>
/* Read the data found in bucket entry ELEM_LOC in file DBF and
@@ -29,11 +30,12 @@
char *
_gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
{
- int num_bytes; /* For seeking and reading. */
+ int num_bytes = 0; /* For seeking and reading. */
int key_size;
int data_size;
off_t file_pos;
data_cache_elem *data_ca;
+ int bytes_read;
/* Is it already in the cache? */
if (dbf->cache_entry->ca_data.elem_loc == elem_loc)
@@ -61,7 +63,12 @@ _gdbm_read_entry (GDBM_FILE dbf, int ele
file_pos = __lseek (dbf, dbf->bucket->h_table[elem_loc].data_pointer, L_SET);
if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer)
_gdbm_fatal (dbf, "lseek error");
- num_bytes = __read (dbf, data_ca->dptr, key_size+data_size);
+ do
+ {
+ bytes_read = __read (dbf, data_ca->dptr+num_bytes, key_size+data_size-num_bytes);
+ if (bytes_read > 0) num_bytes += bytes_read;
+ }
+ while ((bytes_read > 0 || (bytes_read == -1 && errno == EINTR)) && num_bytes < key_size+data_size);
if (num_bytes != key_size+data_size) _gdbm_fatal (dbf, "read error");
return data_ca->dptr;

View File

@ -1,8 +1,10 @@
%bcond_with largefile
Summary: A GNU set of database routines which use extensible hashing
Name: gdbm
Version: 1.9.1
Version: 1.10
Release: 1%{?dist}
Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
#Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
Source: gdbm-%{version}.tar.gz
# Prevent gdbm from storing uninitialized memory content
# to database files.
# The change allows Valgrind users to debug their packages without
@ -11,14 +13,13 @@ Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
# from other applications. The patch is taken from Debian.
# See https://bugzilla.redhat.com/show_bug.cgi?id=4457
# See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208927
Patch0: gdbm-1.9.1-zeroheaders.patch
# Make gdbm handle read(2) returning less data than it was asked for.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=274417
Patch1: gdbm-1.9.1-shortread.patch
License: GPLv2+
Patch0: gdbm-1.10-zeroheaders.patch
Patch1: gdbm-1.10-fedora.patch
License: GPLv3+
URL: http://www.gnu.org/software/gdbm/
Group: System Environment/Libraries
BuildRequires: libtool
BuildRequires: gettext
%description
Gdbm is a GNU database indexing library, including routines which use
@ -49,10 +50,13 @@ gdbm database library. You'll also need to install the gdbm package.
%prep
%setup -q
%patch0 -p1 -b .zeroheaders
%patch1 -p1 -b .shortread
%patch1 -p1 -b .fedora
%build
%configure --disable-static --enable-libgdbm-compat
%configure \
--disable-static \
%{!?with_largefile: --disable-largefile} \
--enable-libgdbm-compat
make
@ -60,6 +64,8 @@ make
rm -rf ${RPM_BUILD_ROOT}
%makeinstall
%find_lang %{name}
# create symlinks for compatibility
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/gdbm
ln -sf ../gdbm.h $RPM_BUILD_ROOT/%{_includedir}/gdbm/gdbm.h
@ -88,9 +94,9 @@ if [ $1 = 0 ]; then
--entry="* gdbm: (gdbm). The GNU Database." || :
fi
%files
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING NEWS README
%doc COPYING NEWS README THANKS AUTHORS NOTE-WARNING
%{_libdir}/libgdbm.so.4*
%{_libdir}/libgdbm_compat.so.4*
%{_bindir}/testgdbm
@ -101,9 +107,18 @@ fi
%{_libdir}/libgdbm_compat.so
%{_includedir}/*
%{_infodir}/*.info*
%{_mandir}/man3/*
%{_mandir}/man3/*
%changelog
* Mon Nov 14 2011 Honza Horak <hhorak@redhat.com> - 1.10-1
- Updated to new upstream release 1.10
- Dropped -shortread patch, which has been already applied by upstream
- Disable large file support, that is enabled by default since 1.9,
but not compatible with db files created using gdbm-1.8.3 and lower
- License change to GPLv3+
- Add doc files THANKS AUTHORS NOTE-WARNING
- Changed text in NOTE-WARNING to correspond with build settings
* Tue Sep 20 2011 Honza Horak <hhorak@redhat.com> - 1.9.1-1
- Updated to new upstream release 1.9.1
- Dropped -filestruct, -ndbmlock and -fhs patches, they are not

View File

@ -1 +1 @@
59f6e4c4193cb875964ffbe8aa384b58 gdbm-1.9.1.tar.gz
88770493c2559dc80b561293e39d3570 gdbm-1.10.tar.gz