diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..f087b42
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.tar.gz filter=lfs diff=lfs merge=lfs -text
diff --git a/Makefile b/Makefile
index 443768e..0ad835c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-NAME := libdb4-utils
+NAME := libdb4
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
diff --git a/README.md b/README.md
index 1849bcc..884dae0 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
-# libdb4-utils
+# libdb4
-SMEServer Koozali developed git repo for libdb4-utils core
+SMEServer Koozali developed git repo for libdb4 core
## Wiki
-
https://wiki.koozali.org/libdb4-utils
+
https://wiki.koozali.org/libdb4
## Bugzilla
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=libdb4-utils&product=SME%20Server%2011.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
diff --git a/additional/.gitignore b/additional/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/change-this-to-the-package-name.spec b/change-this-to-the-package-name.spec
deleted file mode 100644
index 36f2943..0000000
--- a/change-this-to-the-package-name.spec
+++ /dev/null
@@ -1,55 +0,0 @@
-%define name libdb4-utils
-%define version 1.0
-%define release 1
-Summary: This is what libdb4-utils does.
-Name: %{name}
-Version: %{version}
-Release: %{release}%{?dist}
-Source: %{name}-%{version}.tar.gz
-License: GNU GPL version 2
-Group: SMEserver/addon
-BuildRoot: %{_tmppath}/%{name}-buildroot
-Prefix: %{_prefix}
-BuildArchitectures: noarch
-BuildRequires: e-smith-devtools
-Requires: e-smith-release >= 10.0
-AutoReqProv: no
-
-%description
-3rd Party (Maintained by Koozali) git repo for libdb4-utils smeserver
-
-%changelog
-* Day MMMM DD YYYY 1.0-1.sme
-- Initial code - create RPM [SME:99999]
-
-%prep
-
-%setup -q
-
-%build
-perl createlinks
-
-%install
-rm -rf $RPM_BUILD_ROOT
-(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
-rm -f %{name}-%{version}-filelist
-/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
-> %{name}-%{version}-filelist
-#echo "%doc COPYING" >> %{name}-%{version}-filelist
-#--dir 'attr(755,user,grp)' \
-#--file 'attr(755,root,root)' \
-
-%clean
-cd ..
-rm -rf %{name}-%{version}
-
-%pre
-
-%preun
-
-%post
-
-%postun
-#uninstall
-%files -f %{name}-%{version}-filelist
-%defattr(-,root,root)
diff --git a/createlinks b/createlinks
deleted file mode 100644
index 02204f2..0000000
--- a/createlinks
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl -w
-
-use esmith::Build::CreateLinks qw(:all);
-use esmith::Build::Backup qw(:all);
-
-# our event specific for updating with yum without reboot
-$event = 'libdb4-utils-update';
-#add here the path to your templates needed to expand
-#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
-
-# Maybe need ths in here as well:
-# /etc/dar/DailyBackup.dcf - if backup requested
-
-foreach my $file (qw(
- /etc/systemd/system-preset/49-koozali.preset
-))
-{
- templates2events( $file, $event );
-};
-#action needed in case we have a systemd unit
-event_link('systemd-default', $event, '10');
-event_link('systemd-reload', $event, '50');
-
-#services we might need to restart
-#event_services($event, 'xxxx' => 'restart', 'yyyy' => 'restart');
-
-#Backup contrib files
-# backup_includes("libdb4-utils", qw(
- # files(s) to be backed up
-#));
-
-#Other possible entries:
-#Server manager entry
-#panel_link("libdb4-utils", 'manager');
-#Events to libdb4-utils
-#$event = 'libdb4-utils-libdb4-utils';
-# safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/libdb4-utils");
-# templates2events("/etc/libdb4-utils/libdb4-utils.conf", $event);
-
-
-
-
-
diff --git a/db-1.85-errno.patch b/db-1.85-errno.patch
new file mode 100644
index 0000000..ccc9ddf
--- /dev/null
+++ b/db-1.85-errno.patch
@@ -0,0 +1,89 @@
+glibc doesn't like errno as the name of a field.
+--- db.1.85/hash/hash.h Mon Feb 18 19:12:14 2002
++++ db.1.85/hash/hash.h Mon Feb 18 19:12:20 2002
+@@ -103,7 +103,7 @@
+ BUFHEAD *cpage; /* Current page */
+ int cbucket; /* Current bucket */
+ int cndx; /* Index of next item on cpage */
+- int errno; /* Error Number -- for DBM
++ int err; /* Error Number -- for DBM
+ * compatability */
+ int new_file; /* Indicates if fd is backing store
+ * or no */
+--- db.1.85/hash/hash.c Mon Feb 18 19:12:24 2002
++++ db.1.85/hash/hash.c Mon Feb 18 19:12:44 2002
+@@ -505,7 +505,7 @@
+ else
+ if (wsize != sizeof(HASHHDR)) {
+ errno = EFTYPE;
+- hashp->errno = errno;
++ hashp->err = errno;
+ return (-1);
+ }
+ for (i = 0; i < NCACHED; i++)
+@@ -536,7 +536,7 @@
+
+ hashp = (HTAB *)dbp->internal;
+ if (flag) {
+- hashp->errno = errno = EINVAL;
++ hashp->err = errno = EINVAL;
+ return (ERROR);
+ }
+ return (hash_access(hashp, HASH_GET, (DBT *)key, data));
+@@ -553,11 +553,11 @@
+
+ hashp = (HTAB *)dbp->internal;
+ if (flag && flag != R_NOOVERWRITE) {
+- hashp->errno = errno = EINVAL;
++ hashp->err = errno = EINVAL;
+ return (ERROR);
+ }
+ if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
+- hashp->errno = errno = EPERM;
++ hashp->err = errno = EPERM;
+ return (ERROR);
+ }
+ return (hash_access(hashp, flag == R_NOOVERWRITE ?
+@@ -574,11 +574,11 @@
+
+ hashp = (HTAB *)dbp->internal;
+ if (flag && flag != R_CURSOR) {
+- hashp->errno = errno = EINVAL;
++ hashp->err = errno = EINVAL;
+ return (ERROR);
+ }
+ if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
+- hashp->errno = errno = EPERM;
++ hashp->err = errno = EPERM;
+ return (ERROR);
+ }
+ return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
+@@ -729,7 +729,7 @@
+
+ hashp = (HTAB *)dbp->internal;
+ if (flag && flag != R_FIRST && flag != R_NEXT) {
+- hashp->errno = errno = EINVAL;
++ hashp->err = errno = EINVAL;
+ return (ERROR);
+ }
+ #ifdef HASH_STATISTICS
+--- db.1.85/hash/ndbm.c Mon Feb 18 19:12:58 2002
++++ db.1.85/hash/ndbm.c Mon Feb 18 19:13:05 2002
+@@ -180,7 +180,7 @@
+ HTAB *hp;
+
+ hp = (HTAB *)db->internal;
+- return (hp->errno);
++ return (hp->err);
+ }
+
+ extern int
+@@ -190,7 +190,7 @@
+ HTAB *hp;
+
+ hp = (HTAB *)db->internal;
+- hp->errno = 0;
++ hp->err = 0;
+ return (0);
+ }
+
diff --git a/db-4.5.20-jni-include-dir.patch b/db-4.5.20-jni-include-dir.patch
new file mode 100644
index 0000000..b0881c3
--- /dev/null
+++ b/db-4.5.20-jni-include-dir.patch
@@ -0,0 +1,12 @@
+diff -up db-4.7.25/dist/configure.ac.jni db-4.7.25/dist/configure.ac
+--- db-4.7.25/dist/configure.ac.jni 2008-08-20 14:22:59.000000000 +0200
++++ db-4.7.25/dist/configure.ac 2008-08-20 14:23:39.000000000 +0200
+@@ -418,7 +418,7 @@ if test "$db_cv_java" = "yes"; then
+ AC_PROG_JAVAC
+ AC_PROG_JAR
+ AC_PROG_JAVA
+- AC_JNI_INCLUDE_DIR
++ JNI_INCLUDE_DIRS="/usr/lib/jvm/java/include /usr/lib/jvm/java/include/linux"
+
+ AC_MSG_CHECKING(java version)
+ case "$JAVA" in
diff --git a/db-4.6.21-1.85-compat.patch b/db-4.6.21-1.85-compat.patch
new file mode 100644
index 0000000..c65b6ac
--- /dev/null
+++ b/db-4.6.21-1.85-compat.patch
@@ -0,0 +1,14 @@
+diff -ur db-4.6.21/dist/Makefile.in db-4.6.21-db.h_include-patched/dist/Makefile.in
+--- db-4.6.21/dist/Makefile.in 2007-07-05 18:35:02.000000000 +0000
++++ db-4.6.21-db.h_include-patched/dist/Makefile.in 2008-09-05 08:59:36.000000000 +0000
+@@ -139,8 +139,8 @@
+ # local libraries, for example. Do that by adding -I options to the DB185INC
+ # line, and -l options to the DB185LIB line.
+ ##################################################
+-DB185INC= -c @CFLAGS@ -I$(srcdir) @CPPFLAGS@
+-DB185LIB=
++DB185INC= -c @CFLAGS@ -I$(srcdir) -I$(srcdir)/db.1.85/PORT/linux/include @CPPFLAGS@
++DB185LIB= ${srcdir}/db.1.85/PORT/linux/libdb.a
+
+ ##################################################
+ # NOTHING BELOW THIS LINE SHOULD EVER NEED TO BE MODIFIED.
diff --git a/db-4.7.25-memp_stat-upstream-fix.patch b/db-4.7.25-memp_stat-upstream-fix.patch
new file mode 100644
index 0000000..51888d6
--- /dev/null
+++ b/db-4.7.25-memp_stat-upstream-fix.patch
@@ -0,0 +1,185 @@
+diff -up db-4.8.30/mp/mp_stat.c.memp_stat db-4.8.30/mp/mp_stat.c
+--- db-4.8.30/mp/mp_stat.c.memp_stat 2010-04-12 22:25:34.000000000 +0200
++++ db-4.8.30/mp/mp_stat.c 2015-05-22 14:42:28.731436789 +0200
+@@ -88,6 +88,13 @@ __memp_stat(env, gspp, fspp, flags)
+ u_int32_t i, st_bytes, st_gbytes, st_hash_buckets, st_pages;
+ uintmax_t tmp_wait, tmp_nowait;
+
++ /*
++ * The array holding the lengths related to the buffer allocated for *fspp.
++ * The first element of the array holds the number of entries allocated.
++ * The second element of the array holds the total number of bytes allocated.
++ */
++ u_int32_t fsp_len[2];
++
+ dbmp = env->mp_handle;
+ mp = dbmp->reginfo[0].primary;
+
+@@ -202,31 +209,53 @@ __memp_stat(env, gspp, fspp, flags)
+ if (fspp != NULL) {
+ *fspp = NULL;
+
+- /* Count the MPOOLFILE structures. */
+- i = 0;
+- len = 0;
+- if ((ret = __memp_walk_files(env,
+- mp, __memp_count_files, &len, &i, flags)) != 0)
+- return (ret);
++ while (*fspp == NULL) {
++ /* Count the MPOOLFILE structures. */
++ i = 0;
++ /*
++ * Allow space for the first __memp_get_files() to align the
++ * structure array to uintmax_t, DB_MPOOL_STAT's most
++ * restrictive field. [#23150]
++ */
++ len = sizeof(uintmax_t);
++ if ((ret = __memp_walk_files(env,
++ mp, __memp_count_files, &len, &i, flags)) != 0)
++ return (ret);
++
++ if (i == 0)
++ return (0);
++
++ /*
++ * Copy the number of DB_MPOOL_FSTAT entries and the number of
++ * bytes allocated for them into fsp_len. Do not count the space
++ * reserved for allignment.
++ */
++ fsp_len[0] = i;
++ fsp_len[1] = len - sizeof(uintmax_t);
+
+- if (i == 0)
+- return (0);
+- len += sizeof(DB_MPOOL_FSTAT *); /* Trailing NULL */
++ len += sizeof(DB_MPOOL_FSTAT *); /* Trailing NULL */
+
+- /* Allocate space */
+- if ((ret = __os_umalloc(env, len, fspp)) != 0)
+- return (ret);
++ /* Allocate space */
++ if ((ret = __os_umalloc(env, len, fspp)) != 0)
++ return (ret);
+
+- tfsp = *fspp;
+- *tfsp = NULL;
++ tfsp = *fspp;
++ *tfsp = NULL;
+
+- /*
+- * Files may have been opened since we counted, don't walk
+- * off the end of the allocated space.
+- */
+- if ((ret = __memp_walk_files(env,
+- mp, __memp_get_files, &tfsp, &i, flags)) != 0)
+- return (ret);
++ /*
++ * Files may have been opened since we counted, if we walk off
++ * the end of the allocated space specified in fsp_len, retry.
++ */
++ if ((ret = __memp_walk_files(env,
++ mp, __memp_get_files, &tfsp, fsp_len, flags)) != 0) {
++ if (ret == DB_BUFFER_SMALL) {
++ __os_ufree(env, *fspp);
++ *fspp = NULL;
++ tfsp = NULL;
++ } else
++ return (ret);
++ }
++ }
+
+ *++tfsp = NULL;
+ }
+@@ -298,29 +327,36 @@ __memp_count_files(env, mfp, argp, count
+ * for the text file names.
+ */
+ static int
+-__memp_get_files(env, mfp, argp, countp, flags)
++__memp_get_files(env, mfp, argp, fsp_len, flags)
+ ENV *env;
+ MPOOLFILE *mfp;
+ void *argp;
+- u_int32_t *countp;
++ u_int32_t fsp_len[];
+ u_int32_t flags;
+ {
+ DB_MPOOL *dbmp;
+ DB_MPOOL_FSTAT **tfsp, *tstruct;
+ char *name, *tname;
+- size_t nlen;
++ size_t nlen, tlen;
+ u_int32_t pagesize;
+
+- if (*countp == 0)
+- return (0);
++ /* We walked through more files than argp was allocated for. */
++ if (fsp_len[0] == 0)
++ return DB_BUFFER_SMALL;
+
+ dbmp = env->mp_handle;
+ tfsp = *(DB_MPOOL_FSTAT ***)argp;
+
+ if (*tfsp == NULL) {
+- /* Add 1 to count because we need to skip over the NULL. */
+- tstruct = (DB_MPOOL_FSTAT *)(tfsp + *countp + 1);
+- tname = (char *)(tstruct + *countp);
++ /*
++ * Add 1 to count because to skip over the NULL end marker.
++ * Align it further for DB_MPOOL_STAT's most restrictive field
++ * because uintmax_t might require stricter alignment than
++ * pointers; e.g., IP32 LL64 SPARC. [#23150]
++ */
++ tstruct = (DB_MPOOL_FSTAT *)&tfsp[fsp_len[0] + 1];
++ tstruct = ALIGNP_INC(tstruct, sizeof(uintmax_t));
++ tname = (char *)&tstruct[fsp_len[0]];
+ *tfsp = tstruct;
+ } else {
+ tstruct = *tfsp + 1;
+@@ -330,12 +366,26 @@ __memp_get_files(env, mfp, argp, countp,
+
+ name = __memp_fns(dbmp, mfp);
+ nlen = strlen(name) + 1;
++
++ /* The space required for file names is larger than argp was allocated for. */
++ tlen = sizeof(DB_MPOOL_FSTAT *) + sizeof(DB_MPOOL_FSTAT) + nlen;
++ if (fsp_len[1] < tlen)
++ return DB_BUFFER_SMALL;
++ else
++ /* Count down the number of bytes left in argp. */
++ fsp_len[1] -= tlen;
++
+ memcpy(tname, name, nlen);
+- *tstruct = mfp->stat;
++ memcpy(tstruct, &mfp->stat, sizeof(mfp->stat));
+ tstruct->file_name = tname;
+
++ /* Grab the pagesize from the mfp. */
++ tstruct->st_pagesize = mfp->stat.st_pagesize;
++
+ *(DB_MPOOL_FSTAT ***)argp = tfsp;
+- (*countp)--;
++
++ /* Count down the number of entries left in argp. */
++ fsp_len[0]--;
+
+ if (LF_ISSET(DB_STAT_CLEAR)) {
+ pagesize = mfp->stat.st_pagesize;
+diff -up db-4.8.30/mp/mp_sync.c.memp_stat db-4.8.30/mp/mp_sync.c
+--- db-4.8.30/mp/mp_sync.c.memp_stat 2010-04-12 22:25:34.000000000 +0200
++++ db-4.8.30/mp/mp_sync.c 2015-05-22 14:38:17.711150804 +0200
+@@ -57,11 +57,13 @@ __memp_walk_files(env, mp, func, arg, co
+ if ((t_ret = func(env,
+ mfp, arg, countp, flags)) != 0 && ret == 0)
+ ret = t_ret;
+- if (ret != 0 && !LF_ISSET(DB_STAT_MEMP_NOERROR))
++ if (ret != 0 &&
++ (!LF_ISSET(DB_STAT_MEMP_NOERROR) || ret == DB_BUFFER_SMALL))
+ break;
+ }
+ MUTEX_UNLOCK(env, hp->mtx_hash);
+- if (ret != 0 && !LF_ISSET(DB_STAT_MEMP_NOERROR))
++ if (ret != 0 &&
++ (!LF_ISSET(DB_STAT_MEMP_NOERROR) || ret == DB_BUFFER_SMALL))
+ break;
+ }
+ return (ret);
diff --git a/db-4.8.30-atomic_compare_exchange.patch b/db-4.8.30-atomic_compare_exchange.patch
new file mode 100644
index 0000000..4b9beb8
--- /dev/null
+++ b/db-4.8.30-atomic_compare_exchange.patch
@@ -0,0 +1,21 @@
+diff -up db-4.8.30/dbinc/atomic.h.old db-4.8.30/dbinc/atomic.h
+--- db-4.8.30/dbinc/atomic.h.old 2018-07-25 13:50:49.612868859 +0200
++++ db-4.8.30/dbinc/atomic.h 2018-07-25 13:51:05.109655187 +0200
+@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
+ #define atomic_inc(env, p) __atomic_inc(p)
+ #define atomic_dec(env, p) __atomic_dec(p)
+ #define atomic_compare_exchange(env, p, o, n) \
+- __atomic_compare_exchange((p), (o), (n))
++ __db_atomic_compare_exchange((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ int temp;
+@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic
+ * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+ * which configure could be changed to use.
+ */
+-static inline int __atomic_compare_exchange(
++static inline int __db_atomic_compare_exchange(
+ db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ atomic_value_t was;
diff --git a/db-4.8.30-cwd-db_config.patch b/db-4.8.30-cwd-db_config.patch
new file mode 100644
index 0000000..652e962
--- /dev/null
+++ b/db-4.8.30-cwd-db_config.patch
@@ -0,0 +1,11 @@
+--- db-5.3.28/src/env/env_open.c.old 2017-06-26 10:32:11.011419981 +0200
++++ db-5.3.28/src/env/env_open.c 2017-06-26 10:32:46.893721233 +0200
+@@ -473,7 +473,7 @@
+ env->db_mode = mode == 0 ? DB_MODE_660 : mode;
+
+ /* Read the DB_CONFIG file. */
+- if ((ret = __env_read_db_config(env)) != 0)
++ if (env->db_home != NULL && (ret = __env_read_db_config(env)) != 0)
+ return (ret);
+
+ /*
diff --git a/db-4.8.30-format-security.patch b/db-4.8.30-format-security.patch
new file mode 100644
index 0000000..ad8b7c2
--- /dev/null
+++ b/db-4.8.30-format-security.patch
@@ -0,0 +1,57 @@
+# Adjustments necessary in order for gcc with -Werror=format-security to compile libdb4
+
+diff -up db-4.8.30/repmgr/repmgr_net.c.broken db-4.8.30/repmgr/repmgr_net.c
+--- db-4.8.30/repmgr/repmgr_net.c.broken 2013-12-03 09:22:53.411671609 +0100
++++ db-4.8.30/repmgr/repmgr_net.c 2013-12-03 09:23:13.020780748 +0100
+@@ -1331,7 +1331,7 @@ __repmgr_listen(env)
+ }
+
+ ret = net_errno;
+- __db_err(env, ret, why);
++ __db_err(env, ret, "%s", why);
+ clean: if (s != INVALID_SOCKET)
+ (void)closesocket(s);
+ return (ret);
+
+diff -up db-4.8.30/crypto/aes_method.c.broken db-4.8.30/crypto/aes_method.c
+--- db-4.8.30/crypto/aes_method.c.broken 2013-12-03 09:31:46.131623201 +0100
++++ db-4.8.30/crypto/aes_method.c 2013-12-03 09:32:12.875772465 +0100
+@@ -267,6 +267,6 @@ __aes_err(env, err)
+ errstr = "AES error unrecognized";
+ break;
+ }
+- __db_errx(env, errstr);
++ __db_errx(env, "%s", errstr);
+ return;
+ }
+
+diff -up db-4.8.30/txn/txn.c.broken db-4.8.30/txn/txn.c
+--- db-4.8.30/txn/txn.c.broken 2013-12-03 09:35:35.259668694 +0100
++++ db-4.8.30/txn/txn.c 2013-12-03 09:36:34.155889373 +0100
+@@ -113,7 +113,7 @@ __txn_begin_pp(dbenv, parent, txnpp, fla
+ return (ret);
+ if (parent != NULL && !F_ISSET(parent, TXN_SNAPSHOT) &&
+ LF_ISSET(DB_TXN_SNAPSHOT)) {
+- __db_errx(env,
++ __db_errx(env, "%s",
+ "Child transaction snapshot setting must match parent");
+ return (EINVAL);
+ }
+@@ -168,7 +168,7 @@ __txn_begin(env, ip, parent, txnpp, flag
+
+ *txnpp = NULL;
+ if ((ret = __os_calloc(env, 1, sizeof(DB_TXN), &txn)) != 0) {
+- __db_errx(env, TxnAlloc);
++ __db_errx(env, "%s", TxnAlloc);
+ return (ret);
+ }
+
+@@ -315,7 +315,7 @@ __txn_compensate_begin(env, txnpp)
+ int ret;
+
+ if ((ret = __os_calloc(env, 1, sizeof(DB_TXN), &txn)) != 0) {
+- __db_errx(env, TxnAlloc);
++ __db_errx(env, "%s", TxnAlloc);
+ return (ret);
+ }
+
diff --git a/db-4.8.30-quotas-segfault.patch b/db-4.8.30-quotas-segfault.patch
new file mode 100644
index 0000000..d567ccd
--- /dev/null
+++ b/db-4.8.30-quotas-segfault.patch
@@ -0,0 +1,14 @@
+# Sanity fix; should resolve segfault when no space aviable (#740631)
+
+diff -up db-4.8.30/env/env_file.c.orig db-4.8.30/env/env_file.c
+--- db-4.8.30/env/env_file.c.orig 2013-04-24 16:40:37.367003987 +0200
++++ db-4.8.30/env/env_file.c 2013-04-24 16:40:50.303026442 +0200
+@@ -49,7 +49,7 @@ __db_file_extend(env, fhp, size)
+
+ err: __os_free(env, buf);
+
+- return (0);
++ return (ret);
+ }
+
+ /*
diff --git a/db-4.8.30.tar.gz b/db-4.8.30.tar.gz
new file mode 100644
index 0000000..966ab4d
--- /dev/null
+++ b/db-4.8.30.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e0491a07cdb21fb9aa82773bbbedaeb7639cbd0e7f96147ab46141e0045db72a
+size 22887305
diff --git a/db.1.85.tar.gz b/db.1.85.tar.gz
new file mode 100644
index 0000000..49577d3
--- /dev/null
+++ b/db.1.85.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4220d4ddeb77fb57ba2f37c1aa105d561d3ef85a6fb89c79c3edd735d0e193c6
+size 270953
diff --git a/libdb4.spec b/libdb4.spec
new file mode 100644
index 0000000..e3e9c4e
--- /dev/null
+++ b/libdb4.spec
@@ -0,0 +1,463 @@
+%global __soversion_major 4
+%global __soversion %{__soversion_major}.8
+
+Summary: The Berkeley DB database library (version 4) for C
+Name: libdb4
+Version: 4.8.30
+Release: 30%{?dist}
+URL: http://www.oracle.com/database/berkeley-db/
+License: Sleepycat and BSD
+
+Source0: http://download.oracle.com/berkeley-db/db-%{version}.tar.gz
+Source1: http://download.oracle.com/berkeley-db/db.1.85.tar.gz
+# db-1.85 upstream patches
+Patch10: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.1
+Patch11: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.2
+Patch12: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.3
+Patch13: http://www.oracle.com/technology/products/berkeley-db/db/update/1.85/patch.1.4
+# other patches
+Patch20: db-1.85-errno.patch
+Patch21: db-4.6.21-1.85-compat.patch
+Patch22: db-4.5.20-jni-include-dir.patch
+Patch23: db-4.8.30-quotas-segfault.patch
+Patch24: db-4.8.30-format-security.patch
+Patch25: db-4.7.25-memp_stat-upstream-fix.patch
+Patch26: db-4.8.30-atomic_compare_exchange.patch
+BuildRequires: gcc gcc-c++
+# downstream patch to hotfix rhbz#1464032
+Patch27: db-4.8.30-cwd-db_config.patch
+BuildRequires: chrpath
+BuildRequires: ed
+BuildRequires: java-devel >= 1:1.6.0
+BuildRequires: libtool
+BuildRequires: perl-interpreter
+BuildRequires: perl-Carp
+BuildRequires: tcl-devel >= 8.6.1
+BuildRequires: util-linux-ng
+
+Conflicts: filesystem < 3
+Obsoletes: db4 < 5.0.0
+Provides: db4 = %{version}
+
+%description
+The Berkeley Database (Berkeley DB) is a programmatic toolkit that
+provides embedded database support for both traditional and
+client/server applications. The Berkeley DB includes B+tree, Extended
+Linear Hashing, Fixed and Variable-length record access methods,
+transactions, locking, logging, shared memory caching, and database
+recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
+used by many applications, including Python and Perl, so this should
+be installed on all systems.
+
+%package utils
+Summary: Command line tools for managing Berkeley DB (version 4) databases
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: db4-utils < 5.0.0
+Provides: db4-utils = %{version}
+
+%description utils
+This package contains command-line tools for managing Berkeley DB (version
+4) databases.
+
+%package devel
+Summary: C development files for the Berkeley DB (version 4) library
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: db4-devel < 5.0.0
+Provides: db4-devel = %{version}
+
+%description devel
+This package contains the header files and libraries for building C
+programs which use the Berkeley DB.
+
+%package doc
+Summary: Documentation for the Berkeley DB
+BuildArch: noarch
+Obsoletes: db4-devel-doc < 5.0.0
+Provides: db4-devel-doc = %{version}
+
+%description doc
+This package includes documentation files for the Berkeley DB database.
+
+%package devel-static
+Summary: Berkeley DB (version 4) static libraries
+Requires: %{name}-devel%{?_isa} = %{version}-%{release}
+Obsoletes: db4-devel-static < 5.0.0
+Provides: db4-devel-static = %{version}
+
+%description devel-static
+This package contains static libraries needed for applications that
+require static linking of Berkeley DB.
+
+%package cxx
+Summary: The Berkeley DB database library (version 4) for C++
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: db4-cxx < 5.0.0
+Provides: db4-cxx = %{version}
+
+%description cxx
+This package contains the C++ version of the Berkeley DB library (v4).
+
+%package cxx-devel
+Summary: C++ development files for the Berkeley DB database library (version 4)
+Requires: %{name}-cxx%{?_isa} = %{version}-%{release}
+Requires: %{name}-devel%{?_isa} = %{version}-%{release}
+Obsoletes: db4-cxx-devel < 5.0.0
+Provides: db4-cxx-devel = %{version}
+
+%description cxx-devel
+This package contains the header files and libraries for building C++
+programs which use the Berkeley DB.
+
+%package tcl
+Summary: Development files for using the Berkeley DB (version 4) with tcl
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: db4-tcl < 5.0.0
+Provides: db4-tcl = %{version}
+
+%description tcl
+This package contains the libraries for building programs which use the
+Berkeley DB in Tcl.
+
+%package tcl-devel
+Summary: Development files for using the Berkeley DB (version 4) with tcl
+Requires: %{name}-tcl%{?_isa} = %{version}-%{release}
+Obsoletes: db4-tcl-devel < 5.0.0
+Provides: db4-tcl-devel = %{version}
+
+%description tcl-devel
+This package contains the libraries for building programs which use the
+Berkeley DB in Tcl.
+
+%package java
+Summary: Development files for using the Berkeley DB (version 4) with Java
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Obsoletes: db4-java < 5.0.0
+Provides: db4-java = %{version}
+
+%description java
+This package contains the libraries for building programs which use the
+Berkeley DB in Java.
+
+%package java-devel
+Summary: Development files for using the Berkeley DB (version 4) with Java
+Requires: %{name}-java%{?_isa} = %{version}-%{release}
+Obsoletes: db4-java-devel < 5.0.0
+Provides: db4-java-devel = %{version}
+
+%description java-devel
+This package contains the libraries for building programs which use the
+Berkeley DB in Java.
+
+%prep
+%setup -q -n db-%{version} -a 1
+
+pushd db.1.85/PORT/linux
+%patch10 -p0 -b .1.1
+popd
+pushd db.1.85
+%patch11 -p0 -b .1.2
+%patch12 -p0 -b .1.3
+%patch13 -p0 -b .1.4
+%patch20 -p1 -b .errno
+popd
+
+%patch21 -p1 -b .185compat
+%patch22 -p1 -b .4.5.20.jni
+%patch23 -p1 -b .quotas-segfault
+%patch24 -p1 -b .format-security
+%patch25 -p1 -b .memp_stat
+%patch26 -p1 -b .atomic_cmpx
+%patch27 -p2 -b .cwd-db_config
+
+# Fix HREF references in the docs which would otherwise break when we split the docs up into subpackages.
+set +x
+for doc in `find . -name "*.html"`; do
+ chmod u+w ${doc}
+ sed -e 's,="../api_c/,="../../%{name}-devel-%{version}/api_c/,g' \
+ -e 's,="api_c/,="../%{name}-devel-%{version}/api_c/,g' \
+ -e 's,="../api_cxx/,="../../%{name}-devel-%{version}/api_cxx/,g' \
+ -e 's,="api_cxx/,="../%{name}-devel-%{version}/api_cxx/,g' \
+ -e 's,="../api_tcl/,="../../%{name}-devel-%{version}/api_tcl/,g' \
+ -e 's,="api_tcl/,="../%{name}-devel-%{version}/api_tcl/,g' \
+ -e 's,="../java/,="../../%{name}-devel-%{version}/java/,g' \
+ -e 's,="java/,="../%{name}-devel-%{version}/java/,g' \
+ -e 's,="../examples_c/,="../../%{name}-devel-%{version}/examples_c/,g' \
+ -e 's,="examples_c/,="../%{name}-devel-%{version}/examples_c/,g' \
+ -e 's,="../examples_cxx/,="../../%{name}-devel-%{version}/examples_cxx/,g' \
+ -e 's,="examples_cxx/,="../%{name}-devel-%{version}/examples_cxx/,g' \
+ -e 's,="../ref/,="../../%{name}-devel-%{version}/ref/,g' \
+ -e 's,="ref/,="../%{name}-devel-%{version}/ref/,g' \
+ -e 's,="../images/,="../../%{name}-devel-%{version}/images/,g' \
+ -e 's,="images/,="../%{name}-devel-%{version}/images/,g' \
+ -e 's,="../utility/,="../../%{name}-utils-%{version}/utility/,g' \
+ -e 's,="utility/,="../%{name}-utils-%{version}/utility/,g' ${doc} > ${doc}.new
+ touch -r ${doc} ${doc}.new
+ cat ${doc}.new > ${doc}
+ touch -r ${doc}.new ${doc}
+ rm -f ${doc}.new
+done
+set -x
+
+cd dist
+./s_config
+
+%build
+export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
+
+# Build the old db-185 libraries.
+make -C db.1.85/PORT/%{_os} OORG="$CFLAGS"
+
+test -d dist/dist-tls || mkdir dist/dist-tls
+# Static link db_dump185 with old db-185 libraries.
+/bin/sh libtool --tag=CC --mode=compile %{__cc} $RPM_OPT_FLAGS -Idb.1.85/PORT/%{_os}/include -D_REENTRANT -c db_dump185/db_dump185.c -o dist/dist-tls/db_dump185.lo
+/bin/sh libtool --tag=LD --mode=link %{__cc} -o dist/dist-tls/db_dump185 dist/dist-tls/db_dump185.lo db.1.85/PORT/%{_os}/libdb.a
+
+# Update gnu-config files for AArch64
+chmod 644 dist/config.{guess,sub}
+cp /usr/lib/rpm/redhat/config.{guess,sub} dist/
+
+pushd dist/dist-tls
+ln -sf ../configure .
+%configure -C \
+ --enable-compat185 --enable-dump185 \
+ --enable-shared --enable-static \
+ --enable-tcl --with-tcl=%{_libdir} \
+ --enable-cxx \
+ --enable-java \
+ --enable-test \
+ --disable-rpath \
+ --with-tcl=%{_libdir}/tcl8.6
+
+# Remove libtool predep_objects and postdep_objects wonkiness so that
+# building without -nostdlib doesn't include them twice. Because we
+# already link with g++, weird stuff happens if you don't let the
+# compiler handle this.
+perl -pi -e 's/^predep_objects=".*$/predep_objects=""/' libtool
+perl -pi -e 's/^postdep_objects=".*$/postdep_objects=""/' libtool
+perl -pi -e 's/-shared -nostdlib/-shared/' libtool
+
+make %{?_smp_mflags}
+
+# XXX hack around libtool not creating ./libs/libdb_java-X.Y.lai
+LDBJ=./.libs/libdb_java-%{__soversion}.la
+if test -f ${LDBJ} -a ! -f ${LDBJ}i; then
+ sed -e 's,^installed=no,installed=yes,' < ${LDBJ} > ${LDBJ}i
+fi
+
+popd
+
+%install
+mkdir -p ${RPM_BUILD_ROOT}%{_includedir}
+mkdir -p ${RPM_BUILD_ROOT}%{_libdir}
+
+# Disable built-in binaries stripping (#729002)
+%makeinstall STRIP=/bin/true -C dist/dist-tls
+
+# XXX Nuke non-versioned archives and symlinks
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/{libdb.a,libdb_cxx.a}
+
+chmod +x ${RPM_BUILD_ROOT}%{_libdir}/*.so*
+
+# Move the header files to a subdirectory, in case we're deploying on a
+# system with multiple versions of DB installed.
+mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{name}
+mv ${RPM_BUILD_ROOT}%{_includedir}/*.h ${RPM_BUILD_ROOT}%{_includedir}/%{name}
+
+# Move java jar file to the correct place
+# Rename java jar file to fix conflict with libdb (#800359)
+mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/java
+mv ${RPM_BUILD_ROOT}%{_libdir}/*.jar ${RPM_BUILD_ROOT}%{_datadir}/java
+pushd ${RPM_BUILD_ROOT}%{_datadir}/java
+mv db.jar db4.jar
+popd
+
+# Eliminate installed doco
+rm -rf ${RPM_BUILD_ROOT}%{_prefix}/docs
+
+# unify documentation and examples, remove stuff we don't need
+rm -rf docs/csharp
+rm -rf examples/csharp
+rm -rf docs/installation
+
+# XXX Avoid Permission denied. strip when building as non-root.
+chmod u+w ${RPM_BUILD_ROOT}%{_bindir} ${RPM_BUILD_ROOT}%{_bindir}/*
+
+# remove unneeded .la files (#225675)
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
+
+# rename utils so that they won't conflict with libdb (#749293)
+pushd ${RPM_BUILD_ROOT}%{_bindir}
+for i in `ls | sed s/db_//`; do
+ mv db_$i db%{__soversion_major}_$i;
+done
+popd
+
+# put unversioned libraries to separate directory to not to conflict
+# with libdb-devel (#839508)
+mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/%{name}
+pushd ${RPM_BUILD_ROOT}%{_libdir}/%{name}
+for i in libdb libdb_cxx libdb_tcl libdb_java; do
+ rm -f ${RPM_BUILD_ROOT}%{_libdir}/$i.so
+ ln -s ../$i-%{__soversion}.so $i.so
+done
+popd
+
+# remove RPATHs
+chrpath -d ${RPM_BUILD_ROOT}%{_libdir}/*.so ${RPM_BUILD_ROOT}%{_bindir}/*
+
+%ldconfig_scriptlets
+%ldconfig_scriptlets cxx
+%ldconfig_scriptlets tcl
+%ldconfig_scriptlets java
+
+%files
+%license LICENSE
+%doc README
+%{_libdir}/libdb-%{__soversion}.so
+%{_libdir}/libdb-%{__soversion_major}.so
+
+%files devel
+%{_libdir}/%{name}/libdb.so
+%dir %{_includedir}/%{name}
+%{_includedir}/%{name}/db.h
+%{_includedir}/%{name}/db_185.h
+
+%files doc
+%doc docs/*
+%doc examples_c examples_cxx examples_java
+
+%files devel-static
+%{_libdir}/libdb-%{__soversion}.a
+%{_libdir}/libdb_cxx-%{__soversion}.a
+%{_libdir}/libdb_tcl-%{__soversion}.a
+%{_libdir}/libdb_java-%{__soversion}.a
+
+%files utils
+%{_bindir}/db*_archive
+%{_bindir}/db*_checkpoint
+%{_bindir}/db*_deadlock
+%{_bindir}/db*_dump*
+%{_bindir}/db*_hotbackup
+%{_bindir}/db*_load
+%{_bindir}/db*_printlog
+%{_bindir}/db*_recover
+%{_bindir}/db*_sql
+%{_bindir}/db*_stat
+%{_bindir}/db*_upgrade
+%{_bindir}/db*_verify
+
+%files cxx
+%{_libdir}/libdb_cxx-%{__soversion}.so
+%{_libdir}/libdb_cxx-%{__soversion_major}.so
+
+%files cxx-devel
+%{_includedir}/%{name}/db_cxx.h
+%{_libdir}/%{name}/libdb_cxx.so
+
+%files tcl
+%{_libdir}/libdb_tcl-%{__soversion}.so
+%{_libdir}/libdb_tcl-%{__soversion_major}.so
+
+%files tcl-devel
+%{_libdir}/%{name}/libdb_tcl.so
+
+%files java
+%{_libdir}/libdb_java-%{__soversion}*.so
+%{_libdir}/libdb_java-%{__soversion_major}*.so
+%{_datadir}/java/*.jar
+
+%files java-devel
+%{_libdir}/%{name}/libdb_java.so
+
+%changelog
+* Thu Jul 25 2019 Fedora Release Engineering - 4.8.30-30
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
+
+* Fri Feb 01 2019 Fedora Release Engineering - 4.8.30-29
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
+
+* Thu Jul 19 2018 Matej Mužila - 4.8.30-28
+- Do not access DB_CONFIG when db_home is not set
+- Resolves: #1464035 (CVE-2017-10140)
+
+* Fri Jul 13 2018 Fedora Release Engineering - 4.8.30-26
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
+
+* Wed Feb 14 2018 Björn Esser - 4.8.30-25
+- Update spec file to match packaging guidelines (#1545192)
+
+* Wed Feb 07 2018 Fedora Release Engineering - 4.8.30-24
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
+
+* Thu Aug 03 2017 Fedora Release Engineering - 4.8.30-23
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
+
+* Wed Jul 26 2017 Fedora Release Engineering - 4.8.30-22
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
+
+* Fri Feb 10 2017 Fedora Release Engineering - 4.8.30-21
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
+
+* Thu Feb 04 2016 Fedora Release Engineering - 4.8.30-20
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
+
+* Wed Jun 17 2015 Fedora Release Engineering - 4.8.30-19
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
+
+* Fri May 22 2015 Jan Stanek - 4.8.30-18
+- Add upstream fix for memp_stat heap corruption.
+- Resolves: rhbz#1211871
+
+* Sat May 02 2015 Kalev Lember - 4.8.30-17
+- Rebuilt for GCC 5 C++11 ABI change
+
+* Sun Aug 17 2014 Fedora Release Engineering - 4.8.30-16
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
+
+* Tue Jun 10 2014 Jan Stanek - 4.8.30-15
+- Fixed search path for new tcl
+
+* Sat Jun 07 2014 Fedora Release Engineering - 4.8.30-14
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+
+* Tue Dec 03 2013 Jan Stanek - 4.8.30-13
+- Adjusted for -Werror=format-security gcc flag.
+
+* Fri Nov 08 2013 Honza Horak - 4.8.30-12
+- Updated the config files for aarch64 architecture (#1028112)
+
+* Sat Aug 03 2013 Fedora Release Engineering - 4.8.30-11
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+
+* Thu May 16 2013 Jan Stanek - 4.8.30-10
+- Fixed missing debuginfos for utils subpackage (#729002)
+
+* Wed Apr 24 2013 Jan Stanek - 4.8.30-9
+- Added sanity patch fixing crashes when no more disc space left (#740631)
+
+* Tue Apr 02 2013 Jan Stanek - 4.8.30-8
+- Removed dependency on gcc-java
+
+* Tue Mar 26 2013 Jan Stanek - 4.8.30-7
+- Fix file conflict with libdb-java (#800359)
+- Add missing perl-Carp to BuildRequires
+
+* Thu Feb 14 2013 Fedora Release Engineering - 4.8.30-6
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Thu Jul 19 2012 Fedora Release Engineering - 4.8.30-5
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
+
+* Mon Jul 16 2012 Peter Robinson - 4.8.30-4
+- Add db4 provides to allow transisition for name change
+- Spec cleanup
+
+* Sat Jul 14 2012 Peter Robinson - 4.8.30-3
+- Specify tag for libtool
+
+* Thu Jul 12 2012 Jindrich Novy 4.8.30-2
+- fix dependencies in cxx-devel and fix file conflict with
+ libdb-devel (#839508)
+
+* Sun Apr 22 2012 Jindrich Novy 4.8.30-1
+- introduction of libdb4
diff --git a/patch.1.1 b/patch.1.1
new file mode 100644
index 0000000..fe3177d
--- /dev/null
+++ b/patch.1.1
@@ -0,0 +1,20 @@
+*** Makefile.orig Wed Jul 13 21:43:16 1994
+--- Makefile Wed Dec 31 19:00:00 1969
+***************
+*** 15,22 ****
+
+ ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
+ rm -f $@
+! ar cq $@ \
+! `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort`
+ ranlib $@
+
+ clean:
+--- 15,21 ----
+
+ ${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
+ rm -f $@
+! ar cq $@ ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
+ ranlib $@
+
+ clean:
diff --git a/patch.1.2 b/patch.1.2
new file mode 100644
index 0000000..a343909
--- /dev/null
+++ b/patch.1.2
@@ -0,0 +1,19 @@
+*** btree/bt_split.c Tue Jul 26 14:22:02 1994
+--- btree/bt_split.c Sat Jan 4 14:38:55 1997
+***************
+*** 673,679 ****
+ * where we decide to try and copy too much onto the left page.
+ * Make sure that doesn't happen.
+ */
+! if (skip <= off && used + nbytes >= full) {
+ --off;
+ break;
+ }
+--- 673,679 ----
+ * where we decide to try and copy too much onto the left page.
+ * Make sure that doesn't happen.
+ */
+! if (skip <= off && used + nbytes >= full || nxt == top - 1) {
+ --off;
+ break;
+ }
diff --git a/patch.1.3 b/patch.1.3
new file mode 100644
index 0000000..5ca03df
--- /dev/null
+++ b/patch.1.3
@@ -0,0 +1,37 @@
+*** btree/bt_split.c.orig Sat Feb 8 10:14:10 1997
+--- btree/bt_split.c Sat Feb 8 10:14:51 1997
+***************
+*** 673,679 ****
+ * where we decide to try and copy too much onto the left page.
+ * Make sure that doesn't happen.
+ */
+! if (skip <= off && used + nbytes >= full || nxt == top - 1) {
+ --off;
+ break;
+ }
+--- 673,680 ----
+ * where we decide to try and copy too much onto the left page.
+ * Make sure that doesn't happen.
+ */
+! if (skip <= off &&
+! used + nbytes + sizeof(indx_t) >= full || nxt == top - 1) {
+ --off;
+ break;
+ }
+***************
+*** 686,692 ****
+ memmove((char *)l + l->upper, src, nbytes);
+ }
+
+! used += nbytes;
+ if (used >= half) {
+ if (!isbigkey || bigkeycnt == 3)
+ break;
+--- 687,693 ----
+ memmove((char *)l + l->upper, src, nbytes);
+ }
+
+! used += nbytes + sizeof(indx_t);
+ if (used >= half) {
+ if (!isbigkey || bigkeycnt == 3)
+ break;
diff --git a/patch.1.4 b/patch.1.4
new file mode 100644
index 0000000..cec5fbc
--- /dev/null
+++ b/patch.1.4
@@ -0,0 +1,22 @@
+*** btree/bt_page.c.orig Wed Jul 13 21:29:02 1994
+--- btree/bt_page.c Wed Jun 11 20:14:43 1997
+***************
+*** 65,70 ****
+--- 65,71 ----
+ h->prevpg = P_INVALID;
+ h->nextpg = t->bt_free;
+ t->bt_free = h->pgno;
++ F_SET(t, B_METADIRTY);
+
+ /* Make sure the page gets written back. */
+ return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
+***************
+*** 92,97 ****
+--- 93,99 ----
+ (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
+ *npg = t->bt_free;
+ t->bt_free = h->nextpg;
++ F_SET(t, B_METADIRTY);
+ return (h);
+ }
+ return (mpool_new(t->bt_mp, npg));
diff --git a/root/.gitignore b/root/.gitignore
deleted file mode 100644
index e69de29..0000000