[compat-gdbm] Update to 1.8.3

Jan Horak hhorak at fedoraproject.org
Fri Sep 30 13:49:18 UTC 2011


commit cb4014ae803eab1eb24574a94196b60d97fb9a54
Author: Honza Horák <hhorak at redhat.com>
Date:   Fri Sep 30 15:48:38 2011 +0200

    Update to 1.8.3

 .gitignore                   |    2 +
 compat-gdbm.spec             |  242 +++++++++++++++++++++++++++++++++++++-----
 gdbm-1.8.0-64offset.patch    |   64 -----------
 gdbm-1.8.0-fhs.patch         |   96 -----------------
 gdbm-1.8.0-jbj.patch         |   11 --
 gdbm-1.8.3-fhs.patch         |  138 ++++++++++++++++++++++++
 gdbm-1.8.3-filestruct.patch  |   12 ++
 gdbm-1.8.3-ndbmlock.patch    |   94 ++++++++++++++++
 gdbm-1.8.3-shortread.patch   |  113 ++++++++++++++++++++
 gdbm-1.8.3-zeroheaders.patch |   44 ++++++++
 sources                      |    2 +-
 11 files changed, 618 insertions(+), 200 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 13f2497..98e4381 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
 gdbm-1.8.0.tar.gz
+/gdbm-1.8.3-9.fc16.src.rpm
+/gdbm-1.8.3.tar.gz
diff --git a/compat-gdbm.spec b/compat-gdbm.spec
index 91878e3..a8d82fe 100644
--- a/compat-gdbm.spec
+++ b/compat-gdbm.spec
@@ -1,15 +1,34 @@
 Summary: A GNU set of database routines compatibility library
 Name: compat-gdbm
-Version: 1.8.0
-Release: 3%{?dist}
+Version: 1.8.3
+Release: 9%{?dist}
 Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
-Patch0: gdbm-1.8.0-jbj.patch
-Patch1: gdbm-1.8.0-fhs.patch
-Patch3: gdbm-1.8.0-64offset.patch
+# Prevent gdbm from storing uninitialized memory content
+# to database files.
+# The change allows Valgrind users to debug their packages without
+# dealing with gdbm-related noise. It also improves security, as 
+# the uninitialized memory might contain sensitive informations 
+# 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.8.3-zeroheaders.patch
+# Make gdbm buildable. 
+Patch1: gdbm-1.8.3-fhs.patch
+# Make gdbm handle read(2) returning less data than it was asked for.
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=274417
+Patch2: gdbm-1.8.3-shortread.patch
+# dbm_open compatibility function will not lock the database if
+# NDBM_LOCK environment variable is set to false. This is useful:
+# * old applications handle locks themselves (POSIX man page says that
+#   ndbm did not use to lock files, see dbm_clearerr(3p))
+# * locks are degrading performance a lot on NFS shares
+Patch3: gdbm-1.8.3-ndbmlock.patch
+# Prevent compilation of c++ files that use gdbm from warnings.
+# g++ compilator complained about the use of anonymous class
+Patch4: gdbm-1.8.3-filestruct.patch
 License: GPLv2+
 URL: http://www.gnu.org/software/gdbm/
 Group: System Environment/Libraries
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 BuildRequires: libtool
 
 %description
@@ -24,37 +43,45 @@ previous release of Fedora.
 
 %prep
 %setup -q -n gdbm-%{version}
-%patch0 -p1 -b .jbj
+%patch0 -p1 -b .zeroheaders
 %patch1 -p1 -b .fhs
-%patch3 -p1 -b .offset
+%patch2 -p1 -b .shortread
+%patch3 -p1 -b .ndbmlock
+%patch4 -p1 -b .filestruct
 
-%build
-# refresh config.sub, the original one does not recognize "redhat"
-# as vendorname:
-for f in /usr/share/automake-1.1?/config.sub; do
-  :
-done
-cp -p $f .
 libtoolize --force --copy
 aclocal
 autoconf
+
+%build
 %configure --disable-static
+
+# flock does not work on nfs
+# fcntl should be used instead of it
+# see `man 2 flock`
+# rhbz#477300
+echo "/* We use fcntl locking (POSIX) instead of flock (BSD) */" >> autoconf.h
+echo "#undef HAVE_FLOCK" >> autoconf.h
+
 make
 
 %install
 rm -rf ${RPM_BUILD_ROOT}
-
 %makeinstall install-compat
-ln -sf libgdbm.so.2.0.0 $RPM_BUILD_ROOT/%{_libdir}/libgdbm.so
-rm -f $RPM_BUILD_ROOT/%{_libdir}/libgdbm.la
+ln -sf libgdbm.so.3.0.0 $RPM_BUILD_ROOT/%{_libdir}/libgdbm.so
+ln -sf libgdbm_compat.so.3.0.0 $RPM_BUILD_ROOT/%{_libdir}/libgdbm_compat.so
 
 # Devel files are almost identical to gdbm-devel package.
 # Packages should be built against gdbm-devel.
 rm -f $RPM_BUILD_ROOT/%{_libdir}/libgdbm.so
+rm -f $RPM_BUILD_ROOT/%{_libdir}/libgdbm_compat.so
 rm -rf $RPM_BUILD_ROOT/%{_includedir}/gdbm*
 rm -f $RPM_BUILD_ROOT/%{_infodir}/*.info*
 rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/*
 
+rm -f $RPM_BUILD_ROOT/%{_libdir}/libgdbm.la
+rm -f $RPM_BUILD_ROOT/%{_libdir}/libgdbm_compat.la
+
 %post -p /sbin/ldconfig
 
 %postun -p /sbin/ldconfig
@@ -62,18 +89,177 @@ rm -f $RPM_BUILD_ROOT/%{_mandir}/man3/*
 %files
 %defattr(-,root,root,-)
 %doc COPYING NEWS README
-%{_libdir}/libgdbm.so.2*
-
-%clean
-rm -rf ${RPM_BUILD_ROOT}
+%{_libdir}/libgdbm.so.3*
+%{_libdir}/libgdbm_compat.so.3*
 
 %changelog
-* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.0-3
+* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.3-9
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
-* Thu Mar 11 2010 Karel Klic <kklic at redhat.com> - 1.8.0-2
-- Removed `Obsoletes: gdbm`
-- Used %%configure --disable-static instead of removing libgdmb.a
+* Thu Jan 13 2011 Jan Horak <hhorak at redhat.com> - 1.8.3-8
+- Added filestruct patch (#668178)
+
+* Mon Jan 03 2011 Karel Klic <kklic at redhat.com> - 1.8.3-7
+- Removed BuildRoot tag
+- Removed %%clean section
+- Added ndbmlock patch (#663932)
+
+* Mon Apr 12 2010 Karel Klic <kklic at redhat.com> - 1.8.3-6
+- Use fcntl instead of flock for locking to make nfs safe (#477300)
+
+* Thu Mar 11 2010 Karel Klic <kklic at redhat.com> - 1.8.3-5
+- Removed fake Provides: libgdbm.so.2 and corresponding symlinks
+- Moved autoconf, libtoolize from %%build to %%prep section
+- Remove static builds from the devel package (#556050)
+
+* Thu Mar 11 2010 Karel Klic <kklic at redhat.com> - 1.8.3-4
+- Provides: libgdbm.so.2()(64bit) for x86_64 architecture
+
+* Thu Mar 11 2010 Karel Klic <kklic at redhat.com> - 1.8.3-3
+- Added temporary symlinks to retain compatibility with gdbm 1.8.0
+
+* Wed Mar 10 2010 Rex Dieter <rdieter at fedoraproject.org> - 1.8.3-2
+- %%files: track shlib sonames, so abi breaks are less of a surprise
+
+* Tue Mar 09 2010 Karel Klic <kklic at redhat.com> - 1.8.3-1
+- Newer upstream release
+- Removed gdbm-1.8.0-64offset.patch, because it was merged by the upstream
+- `jbj' patch extended and renamed to `zeroheaders'
+- Added shortread patch from Debian
+
+* Fri Jul 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.0-33
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Fri Apr 17 2009 Stepan Kasal <skasal at redhat.com> - 1.8.0-32
+- Clean up the spec, for merge review.
+
+* Fri Feb 27 2009 Stepan Kasal <skasal at redhat.com> - 1.8.0-31
+- drop *-cflags.patch, move all makefile fixes to *-fhs.patch
+- propagate libdir to Makefile; no need to set it on cmdline
+
+* Tue Feb 24 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.8.0-30
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Mon Jul 21 2008 Tom "spot" Callaway <tcallawa at redhat.com> - 1.8.0-29
+- fix license tag
+
+* Tue Feb 19 2008 Fedora Release Engineering <rel-eng at fedoraproject.org> - 1.8.0-28
+- Autorebuild for GCC 4.3
+
+* Tue Apr 3 2007 Ondrej Dvoracek <odvorace at redhat.com> - 1.8.0-27
+- made install-info use in scriptlets safe (#223688)
+
+* Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 1.8.0-26.2.1
+- rebuild
+
+* Fri Feb 10 2006 Jesse Keating <jkeating at redhat.com> - 1.8.0-26.2
+- bump again for double-long bug on ppc(64)
+
+* Tue Feb 07 2006 Jesse Keating <jkeating at redhat.com> - 1.8.0-26.1
+- rebuilt for new gcc4.1 snapshot and glibc changes
+
+* Tue Jan 24 2006 Warren Togami <wtogami at redhat.com> 1.8.0-26
+- remove .la (#171535)
+
+* Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
+- rebuilt
+
+* Sat Apr 09 2005 Florian La Roche <laroche at redhat.com>
+- rebuild
+
+* Sun Aug  8 2004 Alan Cox <alan at redhat.com> 1.8.0-24
+- Close bug #125319
+
+* Tue Jun 15 2004 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Tue Mar 02 2004 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Fri Feb 13 2004 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Wed Jun 04 2003 Elliot Lee <sopwith at redhat.com>
+- rebuilt
+
+* Wed Jan 22 2003 Tim Powers <timp at redhat.com>
+- rebuilt
+
+* Fri Oct  4 2002 Nalin Dahyabhai <nalin at redhat.com> 1.8.0-19
+- rebuild
+
+* Fri Sep 13 2002 Nalin Dahyabhai <nalin at redhat.com> 1.8.0-18.1
+- run make with libdir overridden so that it has the value passed to configure
+  instead of $(prefix)/lib
+
+* Wed Jul 24 2002 Trond Eivind Glomsrød <teg at redhat.com> 1.8.0-18
+- Remove cflags for large database support - not compatible 
+  with databases without it
+
+* Fri Jun 21 2002 Tim Powers <timp at redhat.com>
+- automated rebuild
+
+* Thu May 23 2002 Tim Powers <timp at redhat.com>
+- automated rebuild
+
+* Thu Apr 25 2002 Trond Eivind Glomsrød <teg at redhat.com> 1.8.0-15
+- Use 64bit offset
+- Patch to make the above not break from downsj at downsj.com (#63980) 
+
+* Tue Feb 26 2002 Trond Eivind Glomsrød <teg at redhat.com> 1.8.0-14
+- Rebuild
+
+* Fri Jan 25 2002 Trond Eivind Glomsrød <teg at redhat.com> 1.8.0-13
+- Update location
+- auto* changes to make it build
+
+* Wed Oct 17 2001 Trond Eivind Glomsrød <teg at redhat.com> 1.8.0-11
+- Add URL (# 54607)
+
+* Mon Jun 25 2001 Nalin Dahyabhai <nalin at redhat.com>
+- s/Copyright:/License:/g
+- include text docs in binary package
+
+* Tue Jun 12 2001 Than Ngo <than at redhat.com>
+- fix to build against new libtool
+
+* Mon Mar 19 2001 Trond Eivind Glomsrød <teg at redhat.com>
+- Make it respect RPM_OPT_FLAGS/CFLAGS - #32242. 
+  Patch from dan at D00M.cmc.msu.ru
+
+* Thu Jul 13 2000 Prospector <bugzilla at redhat.com>
+- automatic rebuild
+
+* Mon Jun  5 2000 Jeff Johnson <jbj at redhat.com>
+- FHS packaging.
+
+* Mon Feb  7 2000 Bill Nottingham <notting at redhat.com>
+- handle compressed manpages
+
+* Tue Aug 10 1999 Jeff Johnson <jbj at redhat.com>
+- make sure created database header is initialized (#4457).
+
+* Tue Jun  1 1999 Jeff Johnson <jbj at redhat.com>
+- update to 1.8.0.
+- repackage to include /usr/include/gdbm/*dbm.h compatibility includes.
+
+* Sun Mar 21 1999 Cristian Gafton <gafton at redhat.com> 
+- auto rebuild in the new build environment (release 19)
+
+* Thu Dec 17 1998 Cristian Gafton <gafton at redhat.com>
+- build against glibc 2.1
+
+* Thu May 07 1998 Prospector System <bugs at redhat.com>
+- translations modified for de, fr, tr
+
+* Thu Apr 30 1998 Cristian Gafton <gafton at redhat.com>
+- gdbm-devel moved to Development/Libraries
+
+* Wed Apr 08 1998 Cristian Gafton <gafton at redhat.com>
+- buildroot and built for Manhattan
+
+* Tue Oct 14 1997 Donnie Barnes <djb at redhat.com>
+- spec file cleanups
 
-* Thu Mar 11 2010 Karel Klic <kklic at redhat.com> - 1.8.0-1
-- Initial compat package created from gdbm package 1.8.0-33
+* Thu Jun 12 1997 Erik Troan <ewt at redhat.com>
+- built against glibc
diff --git a/gdbm-1.8.3-fhs.patch b/gdbm-1.8.3-fhs.patch
new file mode 100644
index 0000000..58ce4de
--- /dev/null
+++ b/gdbm-1.8.3-fhs.patch
@@ -0,0 +1,138 @@
+diff -up gdbm-1.8.3/Makefile.in.fhs gdbm-1.8.3/Makefile.in
+--- gdbm-1.8.3/Makefile.in.fhs	2002-10-08 18:09:12.000000000 +0200
++++ gdbm-1.8.3/Makefile.in	2010-03-10 15:41:01.516025096 +0100
+@@ -1,7 +1,7 @@
+ #### Start of system configuration section. ####
+ 
+ srcdir = @srcdir@
+-top_builddir = .
++top_builddir = @top_builddir@
+ VPATH = @srcdir@
+ 
+ CC = @CC@
+@@ -14,17 +14,13 @@ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_DATA = @INSTALL_DATA@
+ 
+-# File ownership and group
+-BINOWN = bin
+-BINGRP = bin
+-
+ MAKEINFO = makeinfo
+ TEXI2DVI = texi2dvi
+ 
+-DEFS =
++DEFS = @DEFS@
+ 
+ # Where the system [n]dbm routines are...
+-LIBS = @LIBS@ -lc
++LIBS = @LIBS@
+ 
+ CFLAGS = @CFLAGS@
+ LDFLAGS = @LDFLAGS@
+@@ -32,16 +28,17 @@ LDFLAGS = @LDFLAGS@
+ # Common prefix for installation directories
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+-binprefix = $(exec_prefix)
+-manprefix = $(prefix)
++datarootdir = @datarootdir@
+ 
+ # Directory in which to put libgdbm.a.
+ libdir = @libdir@
+ # The include directory for gdbm.h and dbm.h.
+ includedir = @includedir@
++pkgincludedir = $(includedir)/gdbm
+ # Info and man directories.
+ infodir = @infodir@
+-man3dir = @mandir@/man3
++mandir = @mandir@
++man3dir = $(mandir)/man3
+ manext = 3
+ 
+ #### End of system configuration section. ####
+@@ -57,7 +54,7 @@ manext = 3
+ 
+ SHELL = /bin/sh
+ 
+-PROGS = libgdbm.la testgdbm testdbm testndbm tndbm tdbm conv2gdbm
++PROGS = libgdbm.la testgdbm testdbm testndbm conv2gdbm
+ 
+ DBM_CF = dbminit.c delete.c fetch.c store.c seq.c close.c
+ 
+@@ -127,26 +124,17 @@ all: libgdbm.la libgdbm_compat.la
+ progs: $(PROGS)
+ 
+ install: libgdbm.la gdbm.h gdbm.info
+-	$(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
+-		$(INSTALL_ROOT)$(includedir) $(INSTALL_ROOT)$(man3dir) \
+-		$(INSTALL_ROOT)$(infodir)
+-	$(LIBTOOL) $(INSTALL) -c libgdbm.la $(INSTALL_ROOT)$(libdir)/libgdbm.la
+-	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h \
+-		$(INSTALL_ROOT)$(includedir)/gdbm.h
+-	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \
+-		$(INSTALL_ROOT)$(man3dir)/gdbm.3
+-	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \
+-		$(INSTALL_ROOT)$(infodir)/gdbm.info
++	$(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir) $(man3dir) $(infodir)
++	$(LIBTOOL) install install libgdbm.la $(libdir)/libgdbm.la
++	$(INSTALL_DATA) gdbm.h $(pkgincludedir)/gdbm.h
++	$(INSTALL_DATA) $(srcdir)/gdbm.3 $(man3dir)/gdbm.3
++	$(INSTALL_DATA) $(srcdir)/gdbm.info $(infodir)/gdbm.info
+ 
+ install-compat:
+-	$(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \
+-		$(INSTALL_ROOT)$(includedir)
+-	$(LIBTOOL) $(INSTALL) -c libgdbm_compat.la \
+-		$(INSTALL_ROOT)$(libdir)/libgdbm_compat.la
+-	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/dbm.h \
+-		$(INSTALL_ROOT)$(includedir)/dbm.h
+-	$(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/ndbm.h \
+-		$(INSTALL_ROOT)$(includedir)/ndbm.h
++	$(srcdir)/mkinstalldirs $(libdir) $(pkgincludedir)
++	$(LIBTOOL) install install libgdbm_compat.la $(libdir)/libgdbm_compat.la
++	$(INSTALL_DATA) $(srcdir)/dbm.h $(pkgincludedir)/dbm.h
++	$(INSTALL_DATA) $(srcdir)/ndbm.h $(pkgincludedir)/ndbm.h
+ 
+ #libgdbm.a: $(OBJS) gdbm.h
+ #	rm -f libgdbm.a
+@@ -161,7 +149,7 @@ libgdbm.la: $(LOBJS) gdbm.h
+ libgdbm_compat.la: $(C_LOBJS) gdbm.h
+ 	rm -f libgdbm_compat.la
+ 	$(LIBTOOL) --mode=link $(CC) -o libgdbm_compat.la -rpath $(libdir) \
+-		-version-info $(SHLIB_VER) $(C_LOBJS)
++		-version-info $(SHLIB_VER) $(C_LOBJS) -lgdbm
+ 
+ gdbm.h:	gdbm.proto gdbmerrno.h gdbm.proto2
+ 	rm -f gdbm.h
+@@ -172,10 +160,10 @@ gdbm.h:	gdbm.proto gdbmerrno.h gdbm.prot
+ 	chmod -w gdbm.h
+ 
+ testgdbm: testgdbm.o libgdbm.la @LIBOBJS@
+-	$(LIBTOOL) $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
++	$(LIBTOOL) link $(CC) $(LDFLAGS) -o testgdbm testgdbm.o libgdbm.la @LIBOBJS@
+ 
+ testdbm: testdbm.o libgdbm.la libgdbm_compat.la
+-	$(LIBTOOL) $(CC) $(LDFLAGS) -o testdbm testdbm.o libgdbm.la libgdbm_compat.la
++	$(LIBTOOL) link $(CC) $(LDFLAGS) -o testdbm testdbm.o $(LIBS) libgdbm_compat.la
+ 
+ tdbm: testdbm.o
+ 	$(CC) $(LDFLAGS) -o tdbm testdbm.o $(LIBS)
+@@ -184,7 +172,7 @@ testndbm.o: testndbm.c
+ 	$(CC) -c -I. -I$(srcdir) $(CFLAGS) $(DEFS) -DGNU $(srcdir)/testndbm.c
+ 
+ testndbm: testndbm.o libgdbm.la libgdbm_compat.la
+-	$(LIBTOOL) $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm.la libgdbm_compat.la
++	$(LIBTOOL) link $(CC) $(LDFLAGS) -o testndbm testndbm.o libgdbm_compat.la
+ 
+ tndbm.o: testndbm.c
+ 	cp $(srcdir)/testndbm.c ./tndbm.c
+@@ -195,7 +183,7 @@ tndbm: tndbm.o
+ 	$(CC) $(LDFLAGS) -o tndbm tndbm.o $(LIBS)
+ 
+ conv2gdbm: conv2gdbm.o libgdbm.la @LIBOBJS@
+-	$(LIBTOOL) $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm.la @LIBOBJS@
++	$(LIBTOOL) link $(CC) $(LDFLAGS) -o conv2gdbm conv2gdbm.o $(LIBS) libgdbm_compat.la @LIBOBJS@
+ 
+ lintgdbm: 
+ 	lint $(DEFS) $(LFLAGS) $(DBM_CF) $(NDBM_CF) $(GDBM_CF) testgdbm.c
diff --git a/gdbm-1.8.3-filestruct.patch b/gdbm-1.8.3-filestruct.patch
new file mode 100644
index 0000000..3e27db8
--- /dev/null
+++ b/gdbm-1.8.3-filestruct.patch
@@ -0,0 +1,12 @@
+diff -up gdbm-1.8.3/gdbm.proto.filestruct gdbm-1.8.3/gdbm.proto
+--- gdbm-1.8.3/gdbm.proto.filestruct	2011-01-13 09:54:03.004907454 +0100
++++ gdbm-1.8.3/gdbm.proto	2011-01-13 09:54:24.881714834 +0100
+@@ -60,7 +60,7 @@ typedef struct {
+ 
+ 
+ /* The file information header. This is good enough for most applications. */
+-typedef struct {int dummy[10];} *GDBM_FILE;
++typedef struct __GDBM_FILE_STRUC {int dummy[10];} *GDBM_FILE;
+ 
+ /* Determine if the C(++) compiler requires complete function prototype  */
+ #ifndef __P
diff --git a/gdbm-1.8.3-ndbmlock.patch b/gdbm-1.8.3-ndbmlock.patch
new file mode 100644
index 0000000..7bc86c3
--- /dev/null
+++ b/gdbm-1.8.3-ndbmlock.patch
@@ -0,0 +1,94 @@
+diff -up gdbm-1.8.3/dbmopen.c.dbmlock gdbm-1.8.3/dbmopen.c
+--- gdbm-1.8.3/dbmopen.c.dbmlock	1999-05-19 02:16:05.000000000 +0200
++++ gdbm-1.8.3/dbmopen.c	2011-01-03 16:17:13.847173371 +0100
+@@ -35,6 +35,28 @@
+ #include "gdbmerrno.h"
+ #include "extern.h"
+ 
++static int
++get_env_bool(env_var, def)
++      const char *env_var;
++      int def;
++{
++  const char *v = getenv(env_var);
++  if (!v)
++    return def;
++
++  if (!strcasecmp(v, "yes") ||
++      !strcasecmp(v, "true") ||
++      !strcasecmp(v, "on"))
++    return 1;
++
++  if (!strcasecmp(v, "no") ||
++      !strcasecmp(v, "false") ||
++      !strcasecmp(v, "off"))
++    return 0;
++
++  return !!atoi(v);
++}
++
+ /* Initialize ndbm system.  FILE is a pointer to the file name.  In
+    standard dbm, the database is found in files called FILE.pag and
+    FILE.dir.  To make gdbm compatable with dbm using the dbminit call,
+@@ -62,7 +84,7 @@ dbm_open (file, flags, mode)
+   char* dir_file;	    /* Used to construct "file.dir". */
+   struct stat dir_stat;	    /* Stat information for "file.dir". */
+   gdbm_file_info *temp_dbf;  /* Temporary file pointer storage. */
+-
++  int gdbm_mode = 0;
+ 
+   /* Prepare the correct names of "file.pag" and "file.dir". */
+   pag_file = (char *) malloc (strlen (file)+5);
+@@ -77,26 +99,22 @@ dbm_open (file, flags, mode)
+   strcat (pag_file, ".pag");
+   strcpy (dir_file, file);
+   strcat (dir_file, ".dir");
+-  
++
++  if (!get_env_bool("NDBM_LOCK", 1))
++      gdbm_mode |= GDBM_NOLOCK;
+ 
+   /* Call the actual routine, saving the pointer to the file information. */
+   flags &= O_RDONLY | O_RDWR | O_CREAT | O_TRUNC;
+   if (flags == O_RDONLY)
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL);
+-    }
++    gdbm_mode |= GDBM_READER;
+   else if (flags == (O_RDWR | O_CREAT))
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL);
+-    }
+-  else if ( (flags & O_TRUNC) == O_TRUNC)
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL);
+-    }
++    gdbm_mode |= GDBM_WRCREAT;
++  else if ((flags & O_TRUNC) == O_TRUNC)
++    gdbm_mode |= GDBM_NEWDB;
+   else
+-    {
+-      temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL);
+-    }
++    gdbm_mode |= GDBM_WRITER;
++
++  temp_dbf = gdbm_open (pag_file, 0, gdbm_mode, mode, NULL);
+ 
+   /* Did we successfully open the file? */
+   if (temp_dbf == NULL)
+diff -up gdbm-1.8.3/gdbm.3.dbmlock gdbm-1.8.3/gdbm.3
+--- gdbm-1.8.3/gdbm.3.dbmlock	2011-01-03 15:59:15.684729255 +0100
++++ gdbm-1.8.3/gdbm.3	2011-01-03 16:17:49.957570637 +0100
+@@ -543,7 +543,11 @@ you must link in the \fIgdbm_compat\fR l
+ .sp
+ 	gcc -o prog proc.c -lgdbm -lgdbm_compat
+ 
+-.SH BUGS
++.SH "ENVIRONMENT VARIABLES"
++\fINDBM_LOCK\fR - When the NDBM interface is used, the database file
++is locked by default. Locking might degrade performance when used on a
++NFS share. This environment variable can be set to false to tell GDBM
++not to lock the database file.
+ 
+ .SH "SEE ALSO"
+ dbm, ndbm
diff --git a/gdbm-1.8.3-shortread.patch b/gdbm-1.8.3-shortread.patch
new file mode 100644
index 0000000..5b6455b
--- /dev/null
+++ b/gdbm-1.8.3-shortread.patch
@@ -0,0 +1,113 @@
+05_handle-short-read.patch
+
+diff -urNad a/bucket.c b/bucket.c
+--- a/bucket.c	1999-05-19 01:16:05.000000000 +0100
++++ b/bucket.c	2006-04-24 03:18:01.000000000 +0100
+@@ -31,7 +31,7 @@
+ #include "autoconf.h"
+ 
+ #include "gdbmdefs.h"
+-
++#include <errno.h>
+ 
+ /* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
+ void
+@@ -68,7 +68,8 @@
+      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. */
+   register int index;	/* Loop index. */
+ 
+@@ -111,7 +112,12 @@
+       if (file_pos != bucket_adr)
+ 	_gdbm_fatal (dbf, "lseek error");
+ 
+-      num_bytes = read (dbf->desc, dbf->bucket, dbf->header->bucket_size);
++      do
++        {
++          bytes_read = read (dbf->desc, 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 -urNad a/falloc.c b/falloc.c
+--- a/falloc.c	2006-04-24 03:17:54.000000000 +0100
++++ b/falloc.c	2006-04-24 03:18:01.000000000 +0100
+@@ -31,7 +31,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. */
+@@ -174,7 +174,8 @@
+ pop_avail_block (dbf)
+      gdbm_file_info *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;
+@@ -199,7 +200,12 @@
+   /* Read the block. */
+   file_pos = lseek (dbf->desc, new_el.av_adr, L_SET);
+   if (file_pos != new_el.av_adr)  _gdbm_fatal (dbf, "lseek error");
+-  num_bytes = read (dbf->desc, new_blk, new_el.av_size);
++  do
++    {
++      bytes_read = read (dbf->desc, 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 -urNad a/findkey.c b/findkey.c
+--- a/findkey.c	1999-05-19 01:16:06.000000000 +0100
++++ b/findkey.c	2006-04-24 03:18:01.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include "autoconf.h"
+ 
+ #include "gdbmdefs.h"
++#include <errno.h>
+ 
+ 
+ /* Read the data found in bucket entry ELEM_LOC in file DBF and
+@@ -41,11 +42,12 @@
+      gdbm_file_info *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)
+@@ -74,7 +76,12 @@
+ 		    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->desc, data_ca->dptr, key_size+data_size);
++  do
++    {
++      bytes_read = read (dbf->desc, 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;
diff --git a/gdbm-1.8.3-zeroheaders.patch b/gdbm-1.8.3-zeroheaders.patch
new file mode 100644
index 0000000..088956a
--- /dev/null
+++ b/gdbm-1.8.3-zeroheaders.patch
@@ -0,0 +1,44 @@
+02_zero-headers.patch by Jeff Johnson <jbj at redhat.com> and Colin Watson <cjwatson at debian.org>
+
+diff -urNad a/falloc.c b/falloc.c
+--- a/falloc.c	2001-02-28 06:52:33.000000000 +0000
++++ b/falloc.c	2003-09-08 23:58:43.000000000 +0100
+@@ -272,7 +272,7 @@
+ 
+ 
+   /* 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");
+   /* Set the size to be correct AFTER the pop_avail_block. */
+   temp->size = dbf->header->avail.size;
+diff -urNad a/gdbmopen.c b/gdbmopen.c
+--- a/gdbmopen.c	2003-09-08 23:58:01.000000000 +0100
++++ b/gdbmopen.c	2003-09-08 23:58:43.000000000 +0100
+@@ -212,7 +212,7 @@
+ 	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);
+@@ -256,7 +256,7 @@
+ 	(dbf->header->block_size - sizeof (hash_bucket))
+ 	/ sizeof (bucket_element) + 1;
+       dbf->header->bucket_size  = dbf->header->block_size;
+-      dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
++      dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+       if (dbf->bucket == NULL)
+ 	{
+ 	  gdbm_close (dbf);
+@@ -420,7 +420,7 @@
+       for(index = 0; index < size; index++)
+         {
+           (dbf->bucket_cache[index]).ca_bucket
+-            = (hash_bucket *) malloc (dbf->header->bucket_size);
++            = (hash_bucket *) calloc (1, dbf->header->bucket_size);
+           if ((dbf->bucket_cache[index]).ca_bucket == NULL)
+ 	    {
+               gdbm_errno = GDBM_MALLOC_ERROR;
diff --git a/sources b/sources
index cd11e3e..b5d5986 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-cd543862287f55ad66e62cc9d82cc906  gdbm-1.8.0.tar.gz
+1d1b1d5c0245b1c00aff92da751e9aa1  gdbm-1.8.3.tar.gz


More information about the scm-commits mailing list