From b1a00e7ab3583a04a8c62865434d50f8dfdcb327 Mon Sep 17 00:00:00 2001 From: Shile Zhang Date: Tue, 15 Mar 2022 20:55:01 +0800 Subject: [PATCH] debug: add *DBM packages and systemtap supports Add perl-*DBM packages and systemtap supports. Signed-off-by: Shile Zhang --- ...M-ODBM-SDBM-_File-objects-only-from-.patch | 234 ++++++++++++++++ ...-compile-with-version-1.20-and-earli.patch | 40 +++ ...f-ITEM_NOT_FOUND-for-pre-1.13-versio.patch | 32 +++ ...number-in-ext-GDBM_File-GDBM_File.pm.patch | 25 ++ ..._MM_LD_RUN_PATH-environment-variable.patch | 91 +++++++ ...=> perl-5.34.0-create_libperl_soname.patch | 0 perl.spec | 251 +++++++++++++++++- perl.stp | 71 +++++ 8 files changed, 736 insertions(+), 8 deletions(-) create mode 100644 perl-5.34.0-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch create mode 100644 perl-5.34.0-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch create mode 100644 perl-5.34.0-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch create mode 100644 perl-5.34.0-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch create mode 100644 perl-5.34.0-add-USE_MM_LD_RUN_PATH-environment-variable.patch rename perl-5.16.3-create_libperl_soname.patch => perl-5.34.0-create_libperl_soname.patch (100%) create mode 100644 perl.stp diff --git a/perl-5.34.0-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch b/perl-5.34.0-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch new file mode 100644 index 0000000..c059b5a --- /dev/null +++ b/perl-5.34.0-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch @@ -0,0 +1,234 @@ +From 8067179e65a28d91f00df7d36778229a07514471 Mon Sep 17 00:00:00 2001 +From: Jitka Plesnikova +Date: Thu, 29 Apr 2021 12:21:18 +0200 +Subject: [PATCH] Destroy {GDBM,NDBM,ODBM,SDBM}_File objects only from original + +This patch fixes a crash when destroing a hash tied to a *_File +database after spawning a thread: + +use Fcntl; +use SDBM_File; +use threads; +tie(my %dbtest, 'SDBM_File', "test.db", O_RDWR|O_CREAT, 0666); +threads->new(sub {})->join; + +This crashed or paniced depending on how perl was configured. + +Closes RT#61912. + +Updated original ppisar's patch for perl 5.18.2 +--- + ext/GDBM_File/GDBM_File.xs | 20 ++++++++++++-------- + ext/NDBM_File/NDBM_File.xs | 16 ++++++++++------ + ext/ODBM_File/ODBM_File.xs | 18 +++++++++++------- + ext/SDBM_File/SDBM_File.xs | 4 +++- + t/lib/dbmt_common.pl | 35 +++++++++++++++++++++++++++++++++++ + 5 files changed, 71 insertions(+), 22 deletions(-) + +diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs +index cd0bb6f..0c395ac 100644 +--- a/ext/GDBM_File/GDBM_File.xs ++++ b/ext/GDBM_File/GDBM_File.xs +@@ -13,6 +13,7 @@ + #define store_value 3 + + typedef struct { ++ tTHX owner; + GDBM_FILE dbp ; + SV * filter[4]; + int filtering ; +@@ -276,6 +277,7 @@ gdbm_TIEHASH(dbtype, name, read_write, mode) + } + if (dbp) { + RETVAL = (GDBM_File)safecalloc(1, sizeof(GDBM_File_type)); ++ RETVAL->owner = aTHX; + RETVAL->dbp = dbp; + } else { + RETVAL = NULL; +@@ -289,15 +291,17 @@ gdbm_DESTROY(db) + PREINIT: + int i = store_value; + CODE: +- if (gdbm_file_close(db)) { +- croak("gdbm_close: %s; %s", gdbm_strerror(gdbm_errno), +- strerror(errno)); ++ if (db && db->owner == aTHX) { ++ if (gdbm_file_close(db)) { ++ croak("gdbm_close: %s; %s", gdbm_strerror(gdbm_errno), ++ strerror(errno)); ++ } ++ do { ++ if (db->filter[i]) ++ SvREFCNT_dec(db->filter[i]); ++ } while (i-- > 0); ++ safefree(db); + } +- do { +- if (db->filter[i]) +- SvREFCNT_dec(db->filter[i]); +- } while (i-- > 0); +- safefree(db); + + void + gdbm_UNTIE(db, count) +diff --git a/ext/NDBM_File/NDBM_File.xs b/ext/NDBM_File/NDBM_File.xs +index eed671a..651fe0f 100644 +--- a/ext/NDBM_File/NDBM_File.xs ++++ b/ext/NDBM_File/NDBM_File.xs +@@ -33,6 +33,7 @@ END_EXTERN_C + #define store_value 3 + + typedef struct { ++ tTHX owner; + DBM * dbp ; + SV * filter[4]; + int filtering ; +@@ -71,6 +72,7 @@ ndbm_TIEHASH(dbtype, filename, flags, mode) + RETVAL = NULL ; + if ((dbp = dbm_open(filename, flags, mode))) { + RETVAL = (NDBM_File)safecalloc(1, sizeof(NDBM_File_type)); ++ RETVAL->owner = aTHX; + RETVAL->dbp = dbp ; + } + +@@ -84,12 +86,14 @@ ndbm_DESTROY(db) + PREINIT: + int i = store_value; + CODE: +- dbm_close(db->dbp); +- do { +- if (db->filter[i]) +- SvREFCNT_dec(db->filter[i]); +- } while (i-- > 0); +- safefree(db); ++ if (db && db->owner == aTHX) { ++ dbm_close(db->dbp); ++ do { ++ if (db->filter[i]) ++ SvREFCNT_dec(db->filter[i]); ++ } while (i-- > 0); ++ safefree(db); ++ } + + #define ndbm_FETCH(db,key) dbm_fetch(db->dbp,key) + datum_value +diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs +index 38e6dbf..4b15a42 100644 +--- a/ext/ODBM_File/ODBM_File.xs ++++ b/ext/ODBM_File/ODBM_File.xs +@@ -49,6 +49,7 @@ datum nextkey(datum key); + #define store_value 3 + + typedef struct { ++ tTHX owner; + void * dbp ; + SV * filter[4]; + int filtering ; +@@ -137,6 +138,7 @@ odbm_TIEHASH(dbtype, filename, flags, mode) + } + dbp = (void*)(dbminit(filename) >= 0 ? &dbmrefcnt : 0); + RETVAL = (ODBM_File)safecalloc(1, sizeof(ODBM_File_type)); ++ RETVAL->owner = aTHX; + RETVAL->dbp = dbp ; + } + OUTPUT: +@@ -149,13 +151,15 @@ DESTROY(db) + dMY_CXT; + int i = store_value; + CODE: +- dbmrefcnt--; +- dbmclose(); +- do { +- if (db->filter[i]) +- SvREFCNT_dec(db->filter[i]); +- } while (i-- > 0); +- safefree(db); ++ if (db && db->owner == aTHX) { ++ dbmrefcnt--; ++ dbmclose(); ++ do { ++ if (db->filter[i]) ++ SvREFCNT_dec(db->filter[i]); ++ } while (i-- > 0); ++ safefree(db); ++ } + + datum_value + odbm_FETCH(db, key) +diff --git a/ext/SDBM_File/SDBM_File.xs b/ext/SDBM_File/SDBM_File.xs +index 0df2855..0e2bd58 100644 +--- a/ext/SDBM_File/SDBM_File.xs ++++ b/ext/SDBM_File/SDBM_File.xs +@@ -10,6 +10,7 @@ + #define store_value 3 + + typedef struct { ++ tTHX owner; + DBM * dbp ; + SV * filter[4]; + int filtering ; +@@ -51,6 +52,7 @@ sdbm_TIEHASH(dbtype, filename, flags, mode, pagname=NULL) + } + if (dbp) { + RETVAL = (SDBM_File)safecalloc(1, sizeof(SDBM_File_type)); ++ RETVAL->owner = aTHX; + RETVAL->dbp = dbp ; + } + +@@ -62,7 +64,7 @@ void + sdbm_DESTROY(db) + SDBM_File db + CODE: +- if (db) { ++ if (db && db->owner == aTHX) { + int i = store_value; + sdbm_close(db->dbp); + do { +diff --git a/t/lib/dbmt_common.pl b/t/lib/dbmt_common.pl +index 60c66ae..a7f81fe 100644 +--- a/t/lib/dbmt_common.pl ++++ b/t/lib/dbmt_common.pl +@@ -510,5 +510,40 @@ unlink , $Dfile; + unlink ; + } + ++{ ++ # Check DBM back-ends do not destroy objects from then-spawned threads. ++ # RT#61912. ++ SKIP: { ++ my $threads_count = 2; ++ skip 'Threads are disabled', 3 + 2 * $threads_count ++ unless $Config{usethreads}; ++ use_ok('threads'); ++ ++ my %h; ++ unlink ; ++ ++ my $db = tie %h, $DBM_Class, 'Op1_dbmx', $create, 0640; ++ isa_ok($db, $DBM_Class); ++ ++ for (1 .. 2) { ++ ok(threads->create( ++ sub { ++ $SIG{'__WARN__'} = sub { fail(shift) }; # debugging perl panics ++ # report it by spurious TAP line ++ 1; ++ }), "Thread $_ created"); ++ } ++ for (threads->list) { ++ is($_->join, 1, "A thread exited successfully"); ++ } ++ ++ pass("Tied object survived exiting threads"); ++ ++ undef $db; ++ untie %h; ++ unlink ; ++ } ++} ++ + done_testing(); + 1; +-- +2.26.3 + diff --git a/perl-5.34.0-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch b/perl-5.34.0-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch new file mode 100644 index 0000000..6157add --- /dev/null +++ b/perl-5.34.0-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch @@ -0,0 +1,40 @@ +From aacd2398e766500cb5d83c4d76b642fcf31d997a Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +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 + diff --git a/perl-5.34.0-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch b/perl-5.34.0-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch new file mode 100644 index 0000000..cc0d4de --- /dev/null +++ b/perl-5.34.0-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch @@ -0,0 +1,32 @@ +From 5bc1e5fdd87aa205011512cd1e6cc655bcf677fd Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +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 + diff --git a/perl-5.34.0-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch b/perl-5.34.0-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch new file mode 100644 index 0000000..4013a14 --- /dev/null +++ b/perl-5.34.0-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch @@ -0,0 +1,25 @@ +From ea57297a58b8f10ab885c19eec48ea076116cc1f Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +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 + diff --git a/perl-5.34.0-add-USE_MM_LD_RUN_PATH-environment-variable.patch b/perl-5.34.0-add-USE_MM_LD_RUN_PATH-environment-variable.patch new file mode 100644 index 0000000..b388350 --- /dev/null +++ b/perl-5.34.0-add-USE_MM_LD_RUN_PATH-environment-variable.patch @@ -0,0 +1,91 @@ +From a3bbea2a318803603850f11d70b6b9820a3571cc Mon Sep 17 00:00:00 2001 +From: Shile Zhang +Date: Wed, 16 Mar 2022 11:37:52 +0800 +Subject: [PATCH] add USE_MM_LD_RUN_PATH environment variable + +Add USE_MM_LD_RUN_PATH helps to enable the MM generated LD_RUN_PATH. +Refers to +https://src.fedoraproject.org/rpms/perl/blob/rawhide/f/perl-USE_MM_LD_RUN_PATH.patch + +Signed-off-by: Shile Zhang +--- + .../lib/ExtUtils/MM_Unix.pm | 2 +- + .../lib/ExtUtils/MakeMaker.pm | 35 +++++++++++++++++-- + 2 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +index 977b50e..3cc9e87 100644 +--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm ++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm +@@ -1077,7 +1077,7 @@ sub xs_make_dynamic_lib { + } + + my $ld_run_path_shell = ""; +- if ($self->{LD_RUN_PATH} ne "") { ++ if (($self->{LD_RUN_PATH} ne "") && ($self->{USE_MM_LD_RUN_PATH})) { + $ld_run_path_shell = 'LD_RUN_PATH="$(LD_RUN_PATH)" '; + } + +diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm +index b9b3836..4325185 100644 +--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm ++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm +@@ -318,7 +318,7 @@ sub full_setup { + PERM_DIR PERM_RW PERM_RWX MAGICXS + PL_FILES PM PM_FILTER PMLIBDIRS PMLIBPARENTDIRS POLLUTE + PREREQ_FATAL PREREQ_PM PREREQ_PRINT PRINT_PREREQ PUREPERL_ONLY +- SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST VERSION VERSION_FROM XS ++ SIGN SKIP TEST_REQUIRES TYPEMAPS UNINST USE_MM_LD_RUN_PATH VERSION VERSION_FROM XS + XSBUILD XSMULTI XSOPT XSPROTOARG XS_VERSION + clean depend dist dynamic_lib linkext macro realclean tool_autosplit + +@@ -505,7 +505,27 @@ sub new { + # PRINT_PREREQ is RedHatism. + if ("@ARGV" =~ /\bPRINT_PREREQ\b/) { + $self->_PRINT_PREREQ; +- } ++ } ++ ++ # USE_MM_LD_RUN_PATH - another RedHatism to disable automatic RPATH generation ++ if ( ( ! $self->{USE_MM_LD_RUN_PATH} ) ++ &&( ("@ARGV" =~ /\bUSE_MM_LD_RUN_PATH(=([01]))?\b/) ++ ||( exists( $ENV{USE_MM_LD_RUN_PATH} ) ++ &&( $ENV{USE_MM_LD_RUN_PATH} =~ /([01])?$/ ) ++ ) ++ ) ++ ) ++ { ++ my $v = $1; ++ if( $v ) ++ { ++ $v = ($v=~/=([01])$/)[0]; ++ }else ++ { ++ $v = 1; ++ }; ++ $self->{USE_MM_LD_RUN_PATH}=$v; ++ }; + + print "MakeMaker (v$VERSION)\n" if $Verbose; + if (-f "MANIFEST" && ! -f "Makefile" && ! $UNDER_CORE){ +@@ -2835,6 +2855,17 @@ precedence. A typemap in the current directory has highest + precedence, even if it isn't listed in TYPEMAPS. The default system + typemap has lowest precedence. + ++=item USE_MM_LD_RUN_PATH ++ ++boolean ++The perl MakeMaker differs from the upstream release which disables use ++of the MakeMaker generated LD_RUN_PATH by default. So add ++USE_MM_LD_RUN_PATH environment variable help to enable it during the ++MakeMaker run. ++ ++USE_MM_LD_RUN_PATH will default to 1 (LD_RUN_PATH will be used) IF the ++$USE_MM_LD_RUN_PATH environment variable is set during a MakeMaker run. ++ + =item VENDORPREFIX + + Like PERLPREFIX, but only for the vendor install locations. +-- +2.33.0.rc2 + diff --git a/perl-5.16.3-create_libperl_soname.patch b/perl-5.34.0-create_libperl_soname.patch similarity index 100% rename from perl-5.16.3-create_libperl_soname.patch rename to perl-5.34.0-create_libperl_soname.patch diff --git a/perl.spec b/perl.spec index 63e9daa..f0ff7df 100644 --- a/perl.spec +++ b/perl.spec @@ -1,6 +1,36 @@ %global perl_version 5.34.0 %global perl_epoch 4 -%global anolis_release 4 +%global anolis_release 5 + +%global parallel_tests 1 +%global tapsetdir %{_datadir}/systemtap/tapset + +# This overrides filters from build root (/usr/lib/rpm/macros.d/macros.perl) +# intentionally (unversioned perl(DB) is removed and versioned one is kept). +%global __provides_exclude_from .*%{_docdir}|.*%{perl_archlib}/.*\\.pl$|.*%{perl_privlib}/.*\\.pl$ +%global __requires_exclude_from %{_docdir} +%global __provides_exclude perl\\((VMS|Win32|BSD::|DB\\)$) +%global __requires_exclude perl\\((VMS|BSD::|Win32|Tk|Mac::|Your::Module::Here) +# same as we provide in /usr/lib/rpm/macros.d/macros.perl +%global perl5_testdir %{_libexecdir}/perl5-tests + +# Optional features +# Run C++ tests +%bcond_without perl_enables_cplusplus_test +# We can bootstrap without gdbm +%bcond_without gdbm +# Support for groff +%bcond_without perl_enables_groff +# Run Turkish locale tests +%bcond_without perl_enables_turkish_test +# Run syslog tests +%bcond_with perl_enables_syslog_test +# SystemTap support +%bcond_without perl_enables_systemtap +# <> operator uses File::Glob nowadays. CSH is not needed. +%bcond_with perl_enables_tcsh +# We can skip %%check phase +%bcond_without test Name: perl License: GPL+ or Artistic @@ -12,24 +42,57 @@ Url: https://www.perl.org/ Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz Source1: macros.perl +Source2: perl.stp -# Define SONAME for libperl.so Patch1: perl-5.16.3-create_libperl_soname.patch +Patch2: perl-USE_MM_LD_RUN_PATH.patch +Patch3: perl-5.34.0-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch +Patch4: perl-5.35.1-Fix-GDBM_File-to-compile-with-version-1.20-and-earli.patch +Patch5: perl-5.35.1-Raise-version-number-in-ext-GDBM_File-GDBM_File.pm.patch +Patch6: perl-5.35.1-Fix-definition-of-ITEM_NOT_FOUND-for-pre-1.13-versio.patch BuildRequires: bash BuildRequires: bzip2-devel BuildRequires: coreutils BuildRequires: findutils BuildRequires: gcc +%if %{with gdbm} +BuildRequires: gdbm-devel +%endif BuildRequires: glibc-common +%if %{with perl_enables_groff} +BuildRequires: groff-base +%endif BuildRequires: libdb-devel BuildRequires: make BuildRequires: perl-interpreter BuildRequires: perl-generators BuildRequires: sed +%if %{with perl_enables_systemtap} +BuildRequires: systemtap-sdt-devel +%endif BuildRequires: tar +%if %{with perl_enables_tcsh} +BuildRequires: tcsh +%endif BuildRequires: zlib-devel +# For tests +%if %{with test} +%if %{with perl_enables_cplusplus_test} +# An optional ExtUtils-CBuilder's test +BuildRequires: gcc-c++ +%endif +BuildRequires: procps +%if %{with perl_enables_turkish_test} +# An optional t/re/fold_grind_T.t test +BuildRequires: glibc-langpack-tr +%endif +%if %{with perl_enables_syslog_test} +BuildRequires: rsyslog +%endif +%endif + # compat macro needed for rebuild %global perl_compat perl(:MODULE_COMPAT_5.34.0) @@ -72,6 +135,9 @@ Requires: perl-File-Find, perl-File-Path, perl-File-stat, perl-File-Temp, Requires: perl-FileCache, perl-FileHandle, perl-filetest, Requires: perl-Filter, perl-Filter-Simple, Requires: perl-FindBin, +%if %{with gdbm} +Requires: perl-GDBM_File, +%endif Requires: perl-Getopt-Long, perl-Getopt-Std, Requires: perl-Hash-Util, perl-Hash-Util-FieldHash, perl-HTTP-Tiny, Requires: perl-if, perl-IO, perl-IO-Compress, perl-IO-Socket-IP, @@ -88,7 +154,13 @@ Requires: perl-Module-CoreList, perl-Module-CoreList-tools, Requires: perl-Module-Load, perl-Module-Load-Conditional, Requires: perl-Module-Loaded, perl-Module-Metadata, Requires: perl-mro, +%if %{with gdbm} +Requires: perl-NDBM_File, +%endif Requires: perl-Net, perl-Net-Ping, perl-NEXT, +%if %{with gdbm} +Requires: perl-ODBM_File, +%endif Requires: perl-Opcode, perl-open, perl-overload, perl-overloading, Requires: perl-parent, perl-PathTools, perl-Params-Check, perl-perlfaq, Requires: perl-PerlIO-via-QuotedPrint, perl-Perl-OSType, @@ -197,6 +269,16 @@ Suggests: perl(DB_File) Requires: perl(DynaLoader) Requires: perl(Encode) Requires: perl(File::Spec) +%if %{with gdbm} +# For AnyDBM_File +Suggests: perl(GDBM_File) +Recommends: perl(NDBM_File) +Suggests: perl(ODBM_File) +%endif +# Term::Cap is optional +%if %{defined perl_bootstrap} +%gendep_perl_libs +%endif %global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\((charnames|DynaLoader)\\)$ @@ -208,6 +290,9 @@ directories). %package devel Summary: Header files for use in perl development License: (GPL+ or Artistic) and UCD +%if %{with perl_enables_systemtap} +Requires: systemtap-sdt-devel +%endif Requires: perl(ExtUtils::ParseXS) Requires: %perl_compat Requires: perl-libs%{?_isa} = %{perl_epoch}:%{perl_version}-%{release} @@ -867,6 +952,24 @@ Conflicts: perl-interpreter < 4:5.30.1-451 Locates the full path to the script bin directory to allow the use of paths relative to the bin directory. +%if %{with gdbm} +%package GDBM_File +Summary: Perl5 access to the gdbm library +License: GPL+ or Artistic +Epoch: 0 +Version: 1.20 +Requires: %perl_compat +%if %{defined perl_bootstrap} +%gendep_perl_GDBM_File +%endif +Conflicts: perl-interpreter < 4:5.30.1-451 + +%description GDBM_File +GDBM_File is a module which allows Perl programs to make use of the facilities +provided by the GNU gdbm library. +%endif + + %package Getopt-Std Summary: Process single-character switches with switch clustering License: GPL+ or Artistic @@ -1141,6 +1244,25 @@ Conflicts: perl-interpreter < 4:5.30.1-451 The "mro" name space provides several utilities for dealing with method resolution order and method caching in general. +%if %{with gdbm} +%package NDBM_File +Summary: Tied access to ndbm files +License: GPL+ or Artistic +Epoch: 0 +Version: 1.15 +Requires: %perl_compat +%if %{defined perl_bootstrap} +%gendep_perl_NDBM_File +%endif +Conflicts: perl-interpreter < 4:5.30.1-451 + +%description NDBM_File +NDBM_File establishes a connection between a Perl hash variable and a file in +ndbm format. You can manipulate the data in the file just as if it were in +a Perl hash, but when your program exits, the data will remain in the file, to +be used the next time your program runs. +%endif + %package Net Summary: By-name interface to Perl built-in network resolver License: GPL+ or Artistic @@ -1170,6 +1292,25 @@ The NEXT module adds a pseudo-class named "NEXT" to any program that uses it. If a method "m" calls "$self->NEXT::m()", the call to "m" is redispatched as if the calling method had not originally been found. +%if %{with gdbm} +%package ODBM_File +Summary: Tied access to odbm files +License: GPL+ or Artistic +Epoch: 0 +Version: 1.17 +Requires: %perl_compat +%if %{defined perl_bootstrap} +%gendep_perl_ODBM_File +%endif +Conflicts: perl-interpreter < 4:5.30.1-451 + +%description ODBM_File +ODBM_File establishes a connection between a Perl hash variable and a file in +odbm format. You can manipulate the data in the file just as if it were in +a Perl hash, but when your program exits, the data will remain in the file, to +be used the next time your program runs. +%endif + %package Opcode Summary: Disable named opcodes when compiling a perl code License: GPL+ or Artistic @@ -1654,6 +1795,10 @@ you're not running VMS, this module does nothing. %setup -q -n perl-%{perl_version} %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 # recode() @@ -1662,12 +1807,6 @@ recode() touch -r "$1" "${1}_" mv -f "${1}_" "$1" } -##recode README.tw big5 -#recode pod/perlebcdic.pod -#recode pod/perlhack.pod -#recode pod/perlhist.pod -#recode pod/perlthrtut.pod -#recode AUTHORS find . -name \*.orig -exec rm -fv {} \; @@ -1680,6 +1819,13 @@ rm -rf cpan/Compress-Raw-Zlib/zlib-src rm -rf cpan/Compress-Raw-Bzip2/bzip2-src sed -i '/\(bzip2\|zlib\)-src/d' MANIFEST +%if !%{with gdbm} +# Do not install anything requiring NDBM_File if NDBM is not available. +rm -rf 'cpan/Memoize/Memoize/NDBM_File.pm' +sed -i '\|cpan/Memoize/Memoize/NDBM_File.pm|d' MANIFEST +%endif + + %build echo "RPM Build arch: %{_arch}" @@ -1705,6 +1851,10 @@ echo "RPM Build arch: %{_arch}" -Dcc='%{__cc}' \ -Dcf_by='OpenAnolis' \ -Dprefix=%{_prefix} \ +%if %{without perl_enables_groff} + -Dman1dir="%{_mandir}/man1" \ + -Dman3dir="%{_mandir}/man3" \ +%endif -Dvendorprefix=%{_prefix} \ -Dsiteprefix=%{_prefix}/local \ -Dsitelib="%{_prefix}/local/share/perl5/%{perl_abi}" \ @@ -1716,10 +1866,18 @@ echo "RPM Build arch: %{_arch}" -Duseshrplib \ -Dusethreads \ -Duseithreads \ +%if %{with perl_enables_systemtap} + -Dusedtrace='/usr/bin/dtrace' \ +%else -Uusedtrace \ +%endif -Duselargefiles \ -Dd_semctl_semun \ -Di_db \ +%if %{with gdbm} + -Ui_ndbm \ + -Di_gdbm \ +%endif -Di_shadow \ -Di_syslog \ -Dman3ext=3pm \ @@ -1803,6 +1961,38 @@ pushd $RPM_BUILD_ROOT%{_mandir}/man1/ done popd +# tests -- FIXME need to validate that this all works as expected +mkdir -p %{buildroot}%{perl5_testdir}/perl-tests + +# "core" +tar -cf - t/ | ( cd %{buildroot}%{perl5_testdir}/perl-tests && tar -xf - ) + +# "dual-lifed" +for dir in `find ext/ -type d -name t -maxdepth 2` ; do + + tar -cf - $dir | ( cd %{buildroot}%{perl5_testdir}/perl-tests/t && tar -xf - ) +done + +# Normalize shell bangs in tests. +# brp-mangle-shebangs executed by rpm-build chokes on t/TEST. +%{new_perl} -MConfig -i -pn \ + -e 's"\A#!(?:perl|\./perl|/perl|/usr/bin/perl|/usr/bin/env perl)\b"$Config{startperl}"' \ + $(find %{buildroot}%{perl5_testdir}/perl-tests -type f) + +%if %{with perl_enables_systemtap} +# Systemtap tapset install +mkdir -p %{buildroot}%{tapsetdir} +%ifarch %{multilib_64_archs} +%global libperl_stp libperl%{perl_version}-64.stp +%else +%global libperl_stp libperl%{perl_version}-32.stp +%endif + +sed \ + -e "s|LIBRARY_PATH|%{_libdir}/%{soname}|" \ + %{SOURCE2} \ + > %{buildroot}%{tapsetdir}/%{libperl_stp} +%endif rm %{buildroot}%{_bindir}/ptar rm %{buildroot}%{_bindir}/ptardiff @@ -2370,6 +2560,19 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %check +%if %{with test} +%{new_perl} -I/lib regen/lib_cleanup.pl +pushd t +%{new_perl} -I../lib porting/customized.t --regen +popd +%if %{parallel_tests} + JOBS=$(printf '%%s' "%{?_smp_mflags}" | sed 's/.*-j\([0-9][0-9]*\).*/\1/') + LC_ALL=C TEST_JOBS=$JOBS make test_harness +%else + LC_ALL=C make test +%endif +%endif + %ldconfig_scriptlets libs %files @@ -2468,10 +2671,18 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %dir %{privlib}/ExtUtils %{privlib}/ExtUtils/typemap %{_libdir}/libperl.so +%if %{with perl_enables_systemtap} +%dir %{_datadir}/systemtap +%dir %{_datadir}/systemtap/tapset +%{tapsetdir}/%{libperl_stp} +%endif %files macros %{_rpmmacrodir}/macros.perl +%files tests +%{perl5_testdir}/ + %files utils %{_bindir}/h2ph %{_bindir}/perlbug @@ -2920,6 +3131,13 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %{privlib}/FindBin.pm %{_mandir}/man3/FindBin.* +%if %{with gdbm} +%files GDBM_File +%{archlib}/GDBM_File.pm +%{archlib}/auto/GDBM_File +%{_mandir}/man3/GDBM_File.3* +%endif + %files Getopt-Std %dir %{privlib}/Getopt %{privlib}/Getopt/Std.pm @@ -3046,6 +3264,13 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %{archlib}/mro.pm %{_mandir}/man3/mro.3* +%if %{with gdbm} +%files NDBM_File +%{archlib}/NDBM_File.pm +%{archlib}/auto/NDBM_File +%{_mandir}/man3/NDBM_File.3* +%endif + %files Net %dir %{privlib}/Net %{privlib}/Net/hostent.pm @@ -3061,6 +3286,13 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %{privlib}/NEXT.pm %{_mandir}/man3/NEXT.* +%if %{with gdbm} +%files ODBM_File +%{archlib}/ODBM_File.pm +%{archlib}/auto/ODBM_File +%{_mandir}/man3/ODBM_File.3* +%endif + %files open %{privlib}/open.pm %{_mandir}/man3/open.3* @@ -3238,6 +3470,9 @@ rm %{buildroot}%{_mandir}/man3/version::Internals.3* %{_mandir}/man3/vmsish.* %changelog +* Wed Mar 16 2022 Shile Zhang - 5.34.0-5 +- add GDBM supports (Shile Zhang) + * Tue Mar 15 2022 Shile Zhang - 5.34.0-4 - add perl-marcors package (Shile Zhang) diff --git a/perl.stp b/perl.stp new file mode 100644 index 0000000..dbc51a8 --- /dev/null +++ b/perl.stp @@ -0,0 +1,71 @@ +/* + This probe will fire when the perl script enters a subroutine. + */ + +probe perl.sub.call = process("LIBRARY_PATH").mark("sub__entry") +{ + + sub = user_string($arg1) + filename = user_string($arg2) + lineno = $arg3 + package = user_string($arg4) + +} + +/* + This probe will fire when the return from a subroutine has been + hit. + */ + +probe perl.sub.return = process("LIBRARY_PATH").mark("sub__return") +{ + + sub = user_string($arg1) + filename = user_string($arg2) + lineno = $arg3 + package = user_string($arg4) + +} + +/* + This probe will fire when the Perl interperter changes state. + */ + +probe perl.phase.change = process("LIBRARY_PATH").mark("phase__change") +{ + newphase = user_string($arg1) + oldphase = user_string($arg2) + +} + + +/* + Fires when Perl has successfully loaded an individual file. + */ + +probe perl.loaded.file = process("LIBRARY_PATH").mark("loaded__file") +{ + filename = user_string($arg1) + +} + + +/* + Fires when Perl is about to load an individual file. + */ + +probe perl.loading.file = process("LIBRARY_PATH").mark("loading__file") +{ + filename = user_string($arg1) + +} + + +/* + Traces the execution of each opcode in the Perl runloop. + */ + +probe perl.op.entry = process("LIBRARY_PATH").mark("op__entry") +{ + opname = user_string($arg1) +} -- Gitee