Compare commits

...

No commits in common. "c8s" and "c9s" have entirely different histories.
c8s ... c9s

7 changed files with 75 additions and 366 deletions

3
.gitignore vendored Normal file → Executable file
View File

@ -3,3 +3,6 @@
/gdbm-1.16.tar.gz
/gdbm-1.17.tar.gz
/gdbm-1.18.tar.gz
/gdbm-1.18.1.tar.gz
/gdbm-1.19.tar.gz
/gdbm-1.23.tar.gz

View File

@ -1,6 +1,6 @@
--- !Policy
product_versions:
- rhel-8
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,14 +0,0 @@
diff -up gdbm-1.10/NOTE-WARNING.fedora gdbm-1.10/NOTE-WARNING
--- gdbm-1.10/NOTE-WARNING.fedora 2011-11-14 17:43:41.267566501 +0100
+++ gdbm-1.10/NOTE-WARNING 2011-11-14 17:47:53.312549265 +0100
@@ -12,8 +12,8 @@ systems where it is not the default. `L
when a system uses 64bit file offsets. Gdbm has, of course, supported `large
files' on systems where it was the default for a very long time.
-On some systems, such as Solaris, this functionality is not enabled by
-default. Gdbm will now enable it. THIS MEANS THAT GDBM 1.9 MAY NOT BE
+On some systems this functionality is not enabled by default. To enable it,
+build rpm with option --with=largefile. THIS MEANS THAT GDBM 1.9 MAY NOT BE
ABLE TO ACCESS DATABASES CREATED BY PREVIOUS VERIONS ON THE SAME SYSTEM.
Running the `configure' script with the `--disable-largefile' flag should

View File

@ -1,298 +0,0 @@
From 2ff4ae9c745d4b9e6ee36468c81554027f66c35b Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Fri, 31 Aug 2018 08:26:31 +0000
Subject: Various bugfixes.
* compat/dbmopen.c (ndbm_open_dir_file0): Ignore ENOENT.
* src/falloc.c (push_avail_block): Free temporary storage no matter
what return status.
* src/gdbm.h.in (GDBM_FILE_TRUNCATE_ERROR): New error code.
* src/gdbmdump.c (_gdbm_dump_ascii): Initialize rc.
* src/gdbmerrno.c: Handle new error.code
* src/gdbmload.c (gdbm_load_bdb_dump): Initialize rc
* src/gdbmopen.c (_gdbm_ftruncate): New function.
(gdbm_fd_open): Use _gdbm_ftruncate. Check its return.
* src/gdbmseq.c (gdbm_firstkey): Initialize dsize
* src/gdbmtool.c (command_generator): Check if cmd is NULL.
(shouldn't happen, but anyways).
* src/mmap.c (_gdbm_mapped_lseek): Check for vailidity of the 'whence'
parameter.
* src/systems.h (TRUNCATE): Remove macro.
* src/util.c (vgetyn): Remove unnecessary assignment.
---
diff --git a/compat/dbmopen.c b/compat/dbmopen.c
index b9e7518..0538992 100644
--- a/compat/dbmopen.c
+++ b/compat/dbmopen.c
@@ -87,7 +87,7 @@ ndbm_open_dir_file0 (const char *file_name, int pagfd, int mode)
if ((mode & GDBM_OPENMASK) == GDBM_READER)
/* Ok, try to cope with it. */
return pagfd;
- else
+ else if (errno != ENOENT)
{
gdbm_set_errno (NULL, GDBM_FILE_OPEN_ERROR, TRUE);
return -1;
diff --git a/src/falloc.c b/src/falloc.c
index 09b40d4..7a94afb 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -313,33 +313,43 @@ push_avail_block (GDBM_FILE dbf)
/* Update the header avail count to previous size divided by 2. */
dbf->header->avail.count >>= 1;
- /* Free the unneeded space. */
- new_loc.av_adr += av_size;
- new_loc.av_size -= av_size;
- _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size);
-
- /* Update the disk. */
- file_pos = gdbm_file_seek (dbf, av_adr, SEEK_SET);
- if (file_pos != av_adr)
+ rc = 0;
+ do
{
- GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
- _gdbm_fatal (dbf, _("lseek error"));
- return -1;
- }
+ /* Free the unneeded space. */
+ new_loc.av_adr += av_size;
+ new_loc.av_size -= av_size;
+ if (_gdbm_free (dbf, new_loc.av_adr, new_loc.av_size))
+ {
+ rc = -1;
+ break;
+ }
+
+ /* Update the disk. */
+ file_pos = gdbm_file_seek (dbf, av_adr, SEEK_SET);
+ if (file_pos != av_adr)
+ {
+ GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
+ _gdbm_fatal (dbf, _("lseek error"));
+ rc = -1;
+ break;
+ }
- rc = _gdbm_full_write (dbf, temp, av_size);
- if (rc)
- {
- GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
- "%s: error writing avail data: %s",
- dbf->name, gdbm_db_strerror (dbf));
- _gdbm_fatal (dbf, gdbm_db_strerror (dbf));
- return -1;
+ rc = _gdbm_full_write (dbf, temp, av_size);
+ if (rc)
+ {
+ GDBM_DEBUG (GDBM_DEBUG_STORE|GDBM_DEBUG_ERR,
+ "%s: error writing avail data: %s",
+ dbf->name, gdbm_db_strerror (dbf));
+ _gdbm_fatal (dbf, gdbm_db_strerror (dbf));
+ rc = -1;
+ }
}
-
+ while (0);
+
free (temp);
- return 0;
+ return rc;
}
/* AV_TABLE contains COUNT entries sorted by AV_SIZE in ascending order.
diff --git a/src/gdbm.h.in b/src/gdbm.h.in
index 6318ad8..f5eadc5 100644
--- a/src/gdbm.h.in
+++ b/src/gdbm.h.in
@@ -227,9 +227,10 @@ extern int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src);
# define GDBM_BAD_DIR_ENTRY 36
# define GDBM_FILE_CLOSE_ERROR 37
# define GDBM_FILE_SYNC_ERROR 38
+# define GDBM_FILE_TRUNCATE_ERROR 39
# define _GDBM_MIN_ERRNO 0
-# define _GDBM_MAX_ERRNO GDBM_FILE_SYNC_ERROR
+# define _GDBM_MAX_ERRNO GDBM_FILE_TRUNCATE_ERROR
/* This one was never used and will be removed in the future */
# define GDBM_UNKNOWN_UPDATE GDBM_UNKNOWN_ERROR
diff --git a/src/gdbmdump.c b/src/gdbmdump.c
index 2e6f5b0..a8c4ec5 100644
--- a/src/gdbmdump.c
+++ b/src/gdbmdump.c
@@ -62,7 +62,7 @@ _gdbm_dump_ascii (GDBM_FILE dbf, FILE *fp)
size_t count = 0;
unsigned char *buffer = NULL;
size_t bufsize = 0;
- int rc;
+ int rc = 0;
fd = gdbm_fdesc (dbf);
if (fstat (fd, &st))
diff --git a/src/gdbmerrno.c b/src/gdbmerrno.c
index 4ce7f9d..6758272 100644
--- a/src/gdbmerrno.c
+++ b/src/gdbmerrno.c
@@ -138,7 +138,8 @@ const char * const gdbm_errlist[_GDBM_MAX_ERRNO+1] = {
[GDBM_BAD_HASH_TABLE] = N_("Malformed hash table"),
[GDBM_BAD_DIR_ENTRY] = N_("Invalid directory entry"),
[GDBM_FILE_CLOSE_ERROR] = N_("Error closing file"),
- [GDBM_FILE_SYNC_ERROR] = N_("Error synchronizing file")
+ [GDBM_FILE_SYNC_ERROR] = N_("Error synchronizing file"),
+ [GDBM_FILE_TRUNCATE_ERROR] = N_("Error truncating file")
};
const char *
@@ -182,7 +183,8 @@ int const gdbm_syserr[_GDBM_MAX_ERRNO+1] = {
[GDBM_FILE_STAT_ERROR] = 1,
[GDBM_BACKUP_FAILED] = 1,
[GDBM_FILE_CLOSE_ERROR] = 1,
- [GDBM_FILE_SYNC_ERROR] = 1
+ [GDBM_FILE_SYNC_ERROR] = 1,
+ [GDBM_FILE_TRUNCATE_ERROR] = 1
};
/* Returns true if system errno value is meaningful for GDBM error
diff --git a/src/gdbmload.c b/src/gdbmload.c
index 008bcb9..f5b7869 100644
--- a/src/gdbmload.c
+++ b/src/gdbmload.c
@@ -542,6 +542,7 @@ gdbm_load_bdb_dump (struct dump_file *file, GDBM_FILE dbf, int replace)
memset (&xd, 0, sizeof (xd));
xs[0] = xs[1] = 0;
i = 0;
+ rc = 0;
while ((c = fgetc (file->fp)) == ' ')
{
rc = xdatum_read (file->fp, &xd[i], &xs[i]);
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index 908887c..7ec57e7 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -199,6 +199,21 @@ validate_header (gdbm_file_header const *hdr, struct stat const *st)
return 0;
}
+/* Do we have ftruncate? */
+static inline int
+_gdbm_ftruncate (GDBM_FILE dbf)
+{
+#if HAVE_FTRUNCATE
+ return ftruncate (dbf->desc, 0);
+#else
+ int fd;
+ fd = open (dbf->name, O_RDWR|O_TRUNC, mode);
+ if (fd == -1)
+ return -1;
+ return close (fd);
+#endif
+}
+
GDBM_FILE
gdbm_fd_open (int fd, const char *file_name, int block_size,
int flags, void (*fatal_func) (const char *))
@@ -320,14 +335,22 @@ gdbm_fd_open (int fd, const char *file_name, int block_size,
now time to truncate the file. */
if ((flags & GDBM_OPENMASK) == GDBM_NEWDB && file_stat.st_size != 0)
{
- TRUNCATE (dbf);
- if (fstat (dbf->desc, &file_stat))
+ if (_gdbm_ftruncate (dbf))
+ {
+ GDBM_SET_ERRNO2 (dbf, GDBM_FILE_TRUNCATE_ERROR, FALSE,
+ GDBM_DEBUG_OPEN);
+ }
+ else if (fstat (dbf->desc, &file_stat))
+ {
+ GDBM_SET_ERRNO2 (dbf, GDBM_FILE_STAT_ERROR, FALSE, GDBM_DEBUG_OPEN);
+ }
+
+ if (gdbm_last_errno (dbf))
{
if (flags & GDBM_CLOERROR)
close (dbf->desc);
free (dbf->name);
free (dbf);
- GDBM_SET_ERRNO2 (NULL, GDBM_FILE_STAT_ERROR, FALSE, GDBM_DEBUG_OPEN);
return NULL;
}
}
diff --git a/src/gdbmseq.c b/src/gdbmseq.c
index e74d78d..ee7ebf3 100644
--- a/src/gdbmseq.c
+++ b/src/gdbmseq.c
@@ -101,6 +101,7 @@ gdbm_firstkey (GDBM_FILE dbf)
/* Set the default return value for not finding a first entry. */
return_val.dptr = NULL;
+ return_val.dsize = 0;
GDBM_DEBUG (GDBM_DEBUG_READ, "%s: getting first key", dbf->name);
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 454465e..8c97e1e 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -1435,7 +1435,7 @@ command_generator (const char *text, int state)
len = strlen (text);
}
- if (!cmd->name)
+ if (!cmd || !cmd->name)
return NULL;
/* Return the next name which partially matches from the command list. */
diff --git a/src/mmap.c b/src/mmap.c
index 48e84ae..148b852 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -367,6 +367,10 @@ _gdbm_mapped_lseek (GDBM_FILE dbf, off_t offset, int whence)
needle = file_size - offset;
break;
}
+
+ default:
+ errno = EINVAL;
+ return -1;
}
if (needle < 0)
diff --git a/src/systems.h b/src/systems.h
index 750aa51..f269060 100644
--- a/src/systems.h
+++ b/src/systems.h
@@ -52,13 +52,6 @@
# define STATBLKSIZE(st) 1024
#endif
-/* Do we have ftruncate? */
-#if HAVE_FTRUNCATE
-# define TRUNCATE(dbf) ftruncate (dbf->desc, 0)
-#else
-# define TRUNCATE(dbf) close( open (dbf->name, O_RDWR|O_TRUNC, mode));
-#endif
-
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
diff --git a/src/util.c b/src/util.c
index f254202..3493366 100644
--- a/src/util.c
+++ b/src/util.c
@@ -98,8 +98,9 @@ vgetyn (const char *prompt, va_list ap)
default:
fprintf (stdout, "%s\n", _("Please, reply 'y' or 'n'"));
}
- state = 0;
- } else
+ /* fall through */
+ }
+ else
break;
case 0:
--
cgit v0.9.0.3

View File

@ -1,24 +0,0 @@
Upstream backport: 00ba17479ff31c6825f0e6f28b965f11525e83f6
Fix problem with loading old format of databases exports
diff -ur gdbm-1.18/src/gdbmopen.c gdbm-patch/src/gdbmopen.c
--- gdbm-1.18/src/gdbmopen.c 2018-08-03 10:46:39.000000000 +0200
+++ gdbm-patch/src/gdbmopen.c 2022-07-01 08:56:08.000000000 +0200
@@ -168,9 +168,14 @@
return GDBM_BLOCK_SIZE_ERROR;
}
- if (hdr->next_block != st->st_size)
- /* FIXME: Should return GDBM_NEED_RECOVERY instead? */
- return GDBM_BAD_HEADER;
+ /* Technically speaking, the condition below should read
+ hdr->next_block != st->st_size
+ However, gdbm versions prior to commit 4e819c98 could leave
+ hdr->next_block pointing beyond current end of file. To ensure
+ backward compatibility with these versions, the condition has been
+ slackened to this: */
+ if (hdr->next_block < st->st_size)
+ return GDBM_BAD_HEADER;
/* Make sure dir and dir + dir_size fall within the file boundary */
if (!(hdr->dir > 0

View File

@ -2,22 +2,23 @@
Summary: A GNU set of database routines which use extensible hashing
Name: gdbm
Version: 1.18
Release: 2%{?dist}
Version: 1.23
Release: 1%{?dist}
Epoch: 1
License: GPLv3+
URL: http://www.gnu.org/software/gdbm/
Source: http://ftp.gnu.org/gnu/gdbm/gdbm-%{version}.tar.gz
Patch1: gdbm-1.17-coverity-fixes.patch
# Backport of upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
Patch2: gdbm-1.18-backward-compatibility.patch
BuildRequires: gcc
BuildRequires: libtool
BuildRequires: gettext
BuildRequires: readline-devel
BuildRequires: make
# when -libs subpkg was introduced
Obsoletes: gdbm < 1:1.14.1-4
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%description
@ -33,6 +34,8 @@ install gdbm-devel.
%package libs
Summary: Libraries files for gdbm
# when -libs subpkg was introduced
Obsoletes: gdbm < 1:1.14.1-4
%description libs
Libraries for the Gdbm GNU database indexing library
@ -53,8 +56,6 @@ gdbm database library. You'll also need to install the gdbm package.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
%configure \
@ -69,10 +70,10 @@ gdbm database library. You'll also need to install the gdbm package.
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make %{?_smp_mflags}
%make_build
%install
make DESTDIR=$RPM_BUILD_ROOT install
%make_install
%find_lang %{name}
@ -93,16 +94,6 @@ make check
%ldconfig_scriptlets libs
%post devel
/sbin/install-info %{_infodir}/gdbm.info.gz %{_infodir}/dir \
--entry="* gdbm: (gdbm). The GNU Database." || :
%preun devel
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/gdbm.info.gz %{_infodir}/dir \
--entry="* gdbm: (gdbm). The GNU Database." || :
fi
%files -f %{name}.lang
%doc NEWS README THANKS AUTHORS NOTE-WARNING
%{_bindir}/gdbm*
@ -121,19 +112,70 @@ fi
%{_mandir}/man3/*
%changelog
* Fri Jul 01 2022 <fjanus@redhat.com> - 1.18-2
- Add backward compatibility patch
- Resolves: #2097704
- Backport from upstream commit: 00ba17479ff31c6825f0e6f28b965f11525e83f6
* Wed Apr 03 2024 Filip Janus <fjanus@redhat.com> - 1:1.23-1
- Update to 1.23
* Mon Sep 03 2018 mskalick@redhat.com - 1:1.18-1
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.19-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.19-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.19-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jan 5 2021 Filip Januš <fjanus@redhat.com> - 1.19-1
- Rebase to latest release 1.19
- Remove gdbm_gcc_10.patch no more necessary
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1:1.18.1-4
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Fri Feb 7 2020 Filip Januš <fjanus@redhat.com> - 1.18.1-3
- Resolves: #1799391
- After upgrade GCC to version gcc version 10.0.1 build fails
- Patch gdbm_gcc_10.patch was added
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sun Oct 13 2019 Christian Stadelmann <genodeftest@fedoraproject.org>
- Remove outdated comments from spec file
* Mon Sep 23 2019 Filip Janus <fjanus@redhat.com> - 1.18.1-1
- Upstream released 1.18.1 bug(#1706639)
- Remove old patches
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:1.18-4
- Rebuild for readline 8.0
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Oct 01 2018 Rex Dieter <rdieter@fedoraproject.org> - 1.18-2
- Add Obsoletes to better handle upgrade path from before -libs was introduced
* Tue Sep 25 2018 mskalick@redhat.com
- Rebase to latest release 1.18
- Fix issues found by coverity
Resolves: RHBZ#1606956
* Tue Aug 21 2018 mskalick@redhat.com - 1:1.17-2
- Fix directory entry validation - fails qsf test suite
* Tue Aug 07 2018 mskalick@redhat.com - 1:1.17-1
- Rebase to upstream release 1.17
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 mskalick@redhat.com - 1:1.16-1
- Rebase to latest release 1.16

2
sources Normal file → Executable file
View File

@ -1 +1 @@
SHA512 (gdbm-1.18.tar.gz) = 57c7e5dc52464e97ad955e28d49fdb3557d8e3bdf280f7d3cee69539e4878f055db17cb9dd591f82fadb8fa5041a5a56d8a571d34f6e115470a3a82537f872a8
SHA512 (gdbm-1.23.tar.gz) = 918080cb0225b221c11eb7339634a95e00c526072395f7a3d46ccf42ef020dea7c4c5bec34aff2c4f16033e1fff6583252b7e978f68b8d7f8736b0e025838e10