diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /core/gdbm |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'core/gdbm')
-rw-r--r-- | core/gdbm/PKGBUILD | 59 | ||||
-rw-r--r-- | core/gdbm/gdbm-1.8.3-fhs.patch | 138 | ||||
-rw-r--r-- | core/gdbm/gdbm-1.8.3-zeroheaders.patch | 44 | ||||
-rw-r--r-- | core/gdbm/gdbm.install | 21 |
4 files changed, 262 insertions, 0 deletions
diff --git a/core/gdbm/PKGBUILD b/core/gdbm/PKGBUILD new file mode 100644 index 000000000..e3c8a2449 --- /dev/null +++ b/core/gdbm/PKGBUILD @@ -0,0 +1,59 @@ +# $Id: PKGBUILD 105198 2011-01-07 13:58:42Z stephane $ +# Maintainer: Allan McRae <allan@archlinux.org> +# Contributor: judd <jvinet@zeroflux.org> + +pkgname=gdbm +pkgver=1.8.3 +pkgrel=8 +pkgdesc="GNU database library" +url="http://www.gnu.org/software/gdbm/gdbm.html" +license=('GPL') +arch=('i686' 'x86_64') +depends=('glibc' 'sh') +source=(ftp://ftp.gnu.org/gnu/gdbm/${pkgname}-${pkgver}.tar.gz + gdbm-1.8.3-zeroheaders.patch + gdbm-1.8.3-fhs.patch) +options=('!libtool' '!makeflags') +install=gdbm.install +md5sums=('1d1b1d5c0245b1c00aff92da751e9aa1' + 'a2ed344be9258775bd718074cf2e4ec6' + '66a7c235416c136dc89efc7d03352514') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + + # Prevent gdbm from storing uninitialized memory content + # to database files. This patch improves security, as the + # uninitialized memory might contain sensitive informations + # from other applications. + # https://bugzilla.redhat.com/show_bug.cgi?id=4457 + # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208927 + patch -Np1 -i ../gdbm-1.8.3-zeroheaders.patch + + # Make gdbm buildable. + patch -Np1 -i ../gdbm-1.8.3-fhs.patch + + libtoolize --force --copy + aclocal + autoconf + + ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info + + # flock does not work on nfs, we use fcntl instead + # https://bugzilla.redhat.com/show_bug.cgi?id=477300 + echo "/* We use fcntl locking (POSIX) instead of flock (BSD) */" >> autoconf.h + echo "#undef HAVE_FLOCK" >> autoconf.h + + make prefix=/usr +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make prefix=$pkgdir/usr \ + manprefix=$pkgdir/usr/share/man \ + man3dir=$pkgdir/usr/share/man/man3 \ + infodir=$pkgdir/usr/share/info \ + install install-compat + + ln -sf gdbm/gdbm.h $pkgdir/usr/include +} diff --git a/core/gdbm/gdbm-1.8.3-fhs.patch b/core/gdbm/gdbm-1.8.3-fhs.patch new file mode 100644 index 000000000..58ce4de0b --- /dev/null +++ b/core/gdbm/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/core/gdbm/gdbm-1.8.3-zeroheaders.patch b/core/gdbm/gdbm-1.8.3-zeroheaders.patch new file mode 100644 index 000000000..088956aef --- /dev/null +++ b/core/gdbm/gdbm-1.8.3-zeroheaders.patch @@ -0,0 +1,44 @@ +02_zero-headers.patch by Jeff Johnson <jbj@redhat.com> and Colin Watson <cjwatson@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/core/gdbm/gdbm.install b/core/gdbm/gdbm.install new file mode 100644 index 000000000..2d1ce2c5a --- /dev/null +++ b/core/gdbm/gdbm.install @@ -0,0 +1,21 @@ +infodir=/usr/share/info +filelist=(gdbm.info) + +post_install() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + usr/bin/install-info $infodir/$file $infodir/dir 2> /dev/null + done +} + +post_upgrade() { + post_install $1 +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + usr/bin/install-info --delete $infodir/$file $infodir/dir 2> /dev/null + done +} + |