Fix GDBM_File to compile with gdbm version 1.20 (bug#1974288)

This commit is contained in:
Jitka Plesnikova 2021-06-25 10:26:46 +02:00
parent 56c2cb6399
commit c422acbc80
4 changed files with 112 additions and 2 deletions

View File

@ -0,0 +1,40 @@
From aacd2398e766500cb5d83c4d76b642fcf31d997a Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Wed, 23 Jun 2021 10:26:50 +0300
Subject: [PATCH 1/3] Fix GDBM_File to compile with version 1.20 and earlier
* ext/GDBM_File/GDBM_File.xs (ITEM_NOT_FOUND): Define conditionally,
depending on the GDBM_VERSION_MAJOR and GDBM_VERSION_MINOR.
Don't assume GDBM_ITEM_NOT_FOUND is a define (it isn't since
gdbm commit d3e27957).
---
ext/GDBM_File/GDBM_File.xs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
index cd0bb6f26f..494c2889ca 100644
--- a/ext/GDBM_File/GDBM_File.xs
+++ b/ext/GDBM_File/GDBM_File.xs
@@ -145,14 +145,13 @@ output_datum(pTHX_ SV *arg, char *str, int size)
#define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
#endif
-#ifndef GDBM_ITEM_NOT_FOUND
-# define GDBM_ITEM_NOT_FOUND GDBM_NO_ERROR
-#endif
-
+#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
/* Prior to 1.13, gdbm_fetch family functions set gdbm_errno to GDBM_NO_ERROR
if the requested key did not exist */
-#define ITEM_NOT_FOUND() \
- (gdbm_errno == GDBM_ITEM_NOT_FOUND || gdbm_errno == GDBM_NO_ERROR)
+# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR)
+#else
+# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_ITEM_NOT_FOUND)
+#endif
#define CHECKDB(db) do { \
if (!db->dbp) { \
--
2.31.1

View File

@ -0,0 +1,32 @@
From 5bc1e5fdd87aa205011512cd1e6cc655bcf677fd Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Wed, 23 Jun 2021 15:31:42 +0300
Subject: [PATCH 3/3] Fix definition of ITEM_NOT_FOUND for pre-1.13 versions.
---
ext/GDBM_File/GDBM_File.xs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
index 494c2889ca..0125b5dcac 100644
--- a/ext/GDBM_File/GDBM_File.xs
+++ b/ext/GDBM_File/GDBM_File.xs
@@ -145,10 +145,11 @@ output_datum(pTHX_ SV *arg, char *str, int size)
#define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
#endif
-#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
-/* Prior to 1.13, gdbm_fetch family functions set gdbm_errno to GDBM_NO_ERROR
- if the requested key did not exist */
-# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR)
+#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
+/* Prior to 1.13, only gdbm_fetch set GDBM_ITEM_NOT_FOUND if the requested
+ key did not exist. Other similar functions would set GDBM_NO_ERROR instead.
+ The GDBM_ITEM_NOT_FOUND existed as early as in 1.7.3 */
+# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR || gdbm_errno == GDBM_ITEM_NOT_FOUND)
#else
# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_ITEM_NOT_FOUND)
#endif
--
2.31.1

View File

@ -0,0 +1,25 @@
From ea57297a58b8f10ab885c19eec48ea076116cc1f Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Wed, 23 Jun 2021 14:24:47 +0300
Subject: [PATCH 2/3] Raise version number in ext/GDBM_File/GDBM_File.pm
---
ext/GDBM_File/GDBM_File.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/GDBM_File/GDBM_File.pm b/ext/GDBM_File/GDBM_File.pm
index d837536f80..cb08d091b8 100644
--- a/ext/GDBM_File/GDBM_File.pm
+++ b/ext/GDBM_File/GDBM_File.pm
@@ -363,7 +363,7 @@ require XSLoader;
);
# This module isn't dual life, so no need for dev version numbers.
-$VERSION = '1.19';
+$VERSION = '1.20';
XSLoader::load();
--
2.31.1

View File

@ -100,7 +100,7 @@ License: GPL+ or Artistic
Epoch: %{perl_epoch}
Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise
Release: 479%{?dist}
Release: 480%{?dist}
Summary: Practical Extraction and Report Language
Url: https://www.perl.org/
Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz
@ -164,6 +164,12 @@ Patch12: perl-5.27.8-hints-linux-Add-lphtread-to-lddlflags.patch
# Pass the correct CFLAGS to dtrace
Patch13: perl-5.28.0-Pass-CFLAGS-to-dtrace.patch
# Fix GDBM_File to compile with gdbm version 1.20 and earlier, GH#18915
# in upstream after 5.35.1
Patch14: perl-5.35.1-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch
Patch15: perl-5.35.1-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch
Patch16: perl-5.35.1-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2105,7 +2111,7 @@ relative to the bin directory.
Summary: Perl5 access to the gdbm library
License: GPL+ or Artistic
Epoch: 0
Version: 1.19
Version: 1.20
Requires: %perl_compat
%if %{defined perl_bootstrap}
%gendep_perl_GDBM_File
@ -4188,6 +4194,9 @@ you're not running VMS, this module does nothing.
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch200 -p1
%patch201 -p1
@ -4208,6 +4217,7 @@ perl -x patchlevel.h \
'Fedora Patch11: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)' \
'Fedora Patch12: Link XS modules to pthread library to fix linking with -z defs' \
'Fedora Patch13: Pass the correct CFLAGS to dtrace' \
'Fedora Patch14: Fix GDBM_File to compile with gdbm version 1.20 (bug#1974288)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -6986,6 +6996,9 @@ popd
# Old changelog entries are preserved in CVS.
%changelog
* Wed Jun 23 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.34.0-480
- Fix GDBM_File to compile with gdbm version 1.20 (bug#1974288)
* Wed Jun 16 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.34.0-479
- Updated list of *.ph files (bug#1972637)