Compare commits

...

40 Commits
f26 ... rawhide

Author SHA1 Message Date
Fedora Release Engineering 97c9676379 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-25 22:18:35 +00:00
Fedora Release Engineering e6d04af172 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-21 20:33:30 +00:00
Fedora Release Engineering cb54bf7ed9 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-21 03:54:03 +00:00
Jitka Plesnikova 26364e7057 Increase release to favour standalone package 2023-07-11 09:39:21 +02:00
Jitka Plesnikova 609d62305f Package tests 2023-05-18 20:01:07 +02:00
Jitka Plesnikova 55888d7121 Package tests 2023-05-18 20:00:47 +02:00
Jitka Plesnikova df2e68c9d6 Upgrade to 1.68 as provided in perl-5.37.11 2023-05-18 19:47:03 +02:00
Fedora Release Engineering 7925b982d8 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-20 08:07:59 +00:00
Jitka Plesnikova 57061d52ee Remove perl(MODULE_COMPAT), it will be replaced by generators 2023-01-13 20:10:29 +01:00
Jitka Plesnikova 2927364c80 Update license to SPDX format 2022-12-20 18:04:27 +01:00
Fedora Release Engineering ff19559a98 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-22 13:01:00 +00:00
Jitka Plesnikova d5cfd6c198 Increase release to favour standalone package 2022-05-30 16:13:51 +02:00
Jitka Plesnikova 551992f0b7 Upgrade to 1.64 as provided in perl-5.35.11 2022-05-12 15:08:28 +02:00
Fedora Release Engineering ba6e7ea523 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-21 07:06:59 +00:00
Fedora Release Engineering f2843720ae - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-23 01:24:28 +00:00
Jitka Plesnikova 70c2939258 Upgrade to 1.62 as provided in perl-5.34.0 2021-05-21 09:27:56 +02:00
Fedora Release Engineering b0b4271b8b - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-27 06:13:46 +00:00
Fedora Release Engineering 2a400c6e16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 20:29:52 +00:00
Jitka Plesnikova fbd6d049d2 Upgrade to 1.61 as provided in perl-5.32.0 2020-06-22 11:17:37 +02:00
Fedora Release Engineering f374b57e6f - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-30 06:38:01 +00:00
Fedora Release Engineering 31b30822e1 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-26 08:30:38 +00:00
Petr Písař 578f0ab660 Modernize a spec file 2019-07-12 09:47:47 +02:00
Petr Písař 8d5acc4373 Fix a memory leak when assigning a shared reference to a shared string variable 2019-07-12 09:40:20 +02:00
Jitka Plesnikova 2bee1b08a3 Increase release to favour standalone package 2019-05-30 11:04:06 +02:00
Jitka Plesnikova 34ccbabd3c Upgrade to 1.60 as provided in perl-5.29.10 2019-04-26 15:10:25 +02:00
Fedora Release Engineering 30ce0ba442 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-02 02:02:13 +00:00
Petr Písař 8172bd4f8f 1.59 bump 2018-11-30 12:41:42 +01:00
Fedora Release Engineering 2cede9bdda - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-13 21:03:04 +00:00
Jitka Plesnikova 597093d915 Increase release to favour standalone package 2018-06-27 02:20:20 +02:00
Petr Písař cb020a7073 cpan.org addresses moved to MetaCPAN <https://fedoraproject.org/wiki/Changes/Perl_Move_to_MetaCPAN> 2018-06-04 14:44:50 +02:00
Fedora Release Engineering 2360102037 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 02:48:43 +00:00
Petr Písař 8614858fa9 1.58 bump 2018-01-24 14:01:36 +01:00
Fedora Release Engineering cb1db96ded - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-03 05:51:36 +00:00
Fedora Release Engineering bacfa86873 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 07:17:57 +00:00
Troy Dawson 20d884aff1 Fix .gitignore 2017-07-18 07:21:30 -07:00
Petr Písař ddb63aeefc perl dependency renamed to perl-interpreter <https://fedoraproject.org/wiki/Changes/perl_Package_to_Install_Core_Modules> 2017-07-12 14:14:30 +02:00
Jitka Plesnikova 61531e14eb Perl 5.26 re-rebuild of bootstrapped packages 2017-06-07 23:33:04 +02:00
Petr Písař d21d5be79d 1.57 bump 2017-06-05 10:35:25 +02:00
Jitka Plesnikova 6c1de29447 Perl 5.26 rebuild 2017-06-03 13:05:33 +02:00
Jitka Plesnikova 06e37734d6 Increase release to favour standalone package 2017-06-03 09:42:21 +02:00
14 changed files with 700 additions and 131 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

4
.gitignore vendored
View File

@ -2,7 +2,6 @@
/threads-shared-1.34.tar.gz
/threads-shared-1.36.tar.gz
/threads-shared-1.37.tar.gz
/perl-threads-shared.spec
/threads-shared-1.39.tar.gz
/threads-shared-1.40.tar.gz
/threads-shared-1.41.tar.gz
@ -14,3 +13,6 @@
/threads-shared-1.52.tar.gz
/threads-shared-1.54.tar.gz
/threads-shared-1.55.tar.gz
/threads-shared-1.57.tar.gz
/threads-shared-1.58.tar.gz
/threads-shared-1.59.tar.gz

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

View File

@ -1,19 +1,32 @@
%global cpan_version 1.55
%global base_version 1.59
Name: perl-threads-shared
Version: 1.56
Release: 1%{?dist}
Version: 1.68
Release: 502%{?dist}
Summary: Perl extension for sharing data structures between threads
License: GPL+ or Artistic
URL: http://search.cpan.org/dist/threads-shared/
Source0: http://www.cpan.org/authors/id/J/JD/JDHEDDEN/threads-shared-%{cpan_version}.tar.gz
# Unbudled from perl-5.25.12
Patch0: threads-shared-1.55-Upgrade-to-1.56.patch
License: GPL-1.0-or-later OR Artistic-1.0-Perl
URL: https://metacpan.org/release/threads-shared
Source0: https://cpan.metacpan.org/authors/id/J/JD/JDHEDDEN/threads-shared-%{base_version}.tar.gz
# Unbundled from perl 5.29.10
Patch0: threads-shared-1.59-Upgrade-to-1.60.patch
# Fix a memory leak when assigning a shared reference to a shared string
# variable, in perl after 5.31.1
Patch1: threads-shared-1.60-threads-shared-fix-leak.patch
# Unbundled from perl 5.32.0
Patch2: threads-shared-1.59-Upgrade-to-1.61.patch
# Unbundled from perl 5.34.0
Patch3: threads-shared-1.61-Upgrade-to-1.62.patch
# Unbundled from perl 5.35.11
Patch4: threads-shared-1.62-Upgrade-to-1.64.patch
# Unbundled from perl 5.37.11
Patch5: threads-shared-1.64-Upgrade-to-1.68.patch
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: make
BuildRequires: perl
BuildRequires: perl-devel
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
# Config_m not needed
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
@ -33,7 +46,6 @@ BuildRequires: perl(Test::More)
BuildRequires: perl(POSIX)
BuildRequires: perl(Time::HiRes)
# Win32 not needed
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Carp)
Requires: perl(threads) >= 1.73
Requires: perl(XSLoader)
@ -46,29 +58,161 @@ thread gets a private copy of each existing variable. This module allows
you to share variables across different threads (and pseudo-forks on
Win32). It is used together with the threads module.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(POSIX)
Requires: perl(Time::HiRes)
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n threads-shared-%{cpan_version}
%patch0 -p1
%setup -q -n threads-shared-%{base_version}
%patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1
%patch -P3 -p1
%patch -P4 -p1
%patch -P5 -p1
# Help generators to recognize Perl scripts
for F in t/*.t t/*pl; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 OPTIMIZE="%{optflags}"
%{make_build}
%install
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
%{_fixperms} $RPM_BUILD_ROOT/*
%{make_install}
find %{buildroot} -type f -name '*.bs' -size 0 -delete
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%check
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
unset GIT_DIR PERL_BUILD_PACKAGING PERL_CORE PERL_RUNPERL_DEBUG \
RUN_MAINTAINER_TESTS
make test
%files
%doc Changes examples README
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/threads*
%{_mandir}/man3/*
%{_mandir}/man3/threads::shared*
%files tests
%{_libexecdir}/%{name}
%changelog
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.68-502
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.68-501
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.68-500
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jul 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.68-499
- Increase release to favour standalone package
* Thu May 18 2023 Jitka Plesnikova <jplesnik@redhat.com> - 1.68-1
- Upgrade to 1.68 as provided in perl-5.37.11
- Package tests
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.64-490
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.64-489
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon May 30 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.64-488
- Increase release to favour standalone package
* Thu May 12 2022 Jitka Plesnikova <jplesnik@redhat.com> - 1.64-1
- Upgrade to 1.64 as provided in perl-5.35.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.62-479
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.62-478
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri May 21 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.62-477
- Upgrade to 1.62 as provided in perl-5.34.0
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.61-458
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.61-457
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.61-456
- Upgrade to 1.61 as provided in perl-5.32.0
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.60-441
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.60-440
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Jul 12 2019 Petr Pisar <ppisar@redhat.com> - 1.60-439
- Fix a memory leak when assigning a shared reference to a shared string
variable
* Thu May 30 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1.60-438
- Increase release to favour standalone package
* Fri Apr 26 2019 Jitka Plesnikova <jplesnik@redhat.com> - 1.60-1
- Upgrade to 1.60 as provided in perl-5.29.10
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.59-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Nov 30 2018 Petr Pisar <ppisar@redhat.com> - 1.59-1
- 1.59 bump
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.58-417
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jun 27 2018 Jitka Plesnikova <jplesnik@redhat.com> - 1.58-416
- Increase release to favour standalone package
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.58-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jan 24 2018 Petr Pisar <ppisar@redhat.com> - 1.58-1
- 1.58 bump
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.57-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.57-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 07 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.57-2
- Perl 5.26 re-rebuild of bootstrapped packages
* Mon Jun 05 2017 Petr Pisar <ppisar@redhat.com> - 1.57-1
- 1.57 bump
* Sat Jun 03 2017 Jitka Plesnikova <jplesnik@redhat.com> - 1.56-393
- Perl 5.26 rebuild
* Thu May 11 2017 Petr Pisar <ppisar@redhat.com> - 1.56-1
- Upgrade to 1.56 as provided in perl-5.25.12
@ -188,7 +332,7 @@ make test
* Wed Aug 17 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.37-3
- change path on vendor, so our debuginfo are not conflicting with
perl core debuginfos
perl core debuginfos
* Mon Jun 20 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.37-2
- Perl mass rebuild

5
plans/sanity.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

View File

@ -1 +1 @@
SHA512 (threads-shared-1.55.tar.gz) = 60fe568616cad49e7e453b8a2647f4f62383fb6538c905b870c363ad8964207214757044f05a8565b8bdbdfb02df3c5f450c20f60a6d0392c9c251003e30e7df
SHA512 (threads-shared-1.59.tar.gz) = 0dc84bc5c1d1cdd3fe70ab6c6fa571b4aa18c24ab6e036531d2ddcc2a8dea31aad05688c30d52b18ee07588bf3c5fee2b585471775bffd8b17c1411142adcdb7

4
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,4 @@
summary: Upstream tests
component: perl-threads-shared
require: perl-threads-shared-tests
test: /usr/libexec/perl-threads-shared/test

View File

@ -1,110 +0,0 @@
From c7f8a613ce96ab9eb7472dfce9beba86c28a4031 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 11 May 2017 13:03:59 +0200
Subject: [PATCH] Upgrade to 1.56
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Unbundled from perl-5.25.12.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/threads/shared.pm | 4 ++--
shared.xs | 6 ++++--
t/object2.t | 24 +++++++++++++++++++++++-
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index 5a203b0..73c4dd9 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -7,7 +7,7 @@ use warnings;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.55'; # Please update the pod, too.
+our $VERSION = '1.56'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -195,7 +195,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.55
+This document describes threads::shared version 1.56
=head1 SYNOPSIS
diff --git a/shared.xs b/shared.xs
index dab5e36..3c1b5e6 100644
--- a/shared.xs
+++ b/shared.xs
@@ -1104,8 +1104,9 @@ sharedsv_array_mg_CLEAR(pTHX_ SV *sv, MAGIC *mg)
if (!sv) continue;
if ( (SvOBJECT(sv) || (SvROK(sv) && (sv = SvRV(sv))))
&& SvREFCNT(sv) == 1 ) {
- SV *tmp = Perl_sv_newmortal(caller_perl);
+ SV *tmp;
PERL_SET_CONTEXT((aTHX = caller_perl));
+ tmp = sv_newmortal();
sv_upgrade(tmp, SVt_RV);
get_RV(tmp, sv);
PERL_SET_CONTEXT((aTHX = PL_sharedsv_space));
@@ -1384,8 +1385,9 @@ STORESIZE(SV *obj,IV count)
if ( (SvOBJECT(sv) || (SvROK(sv) && (sv = SvRV(sv))))
&& SvREFCNT(sv) == 1 )
{
- SV *tmp = Perl_sv_newmortal(caller_perl);
+ SV *tmp;
PERL_SET_CONTEXT((aTHX = caller_perl));
+ tmp = sv_newmortal();
sv_upgrade(tmp, SVt_RV);
get_RV(tmp, sv);
PERL_SET_CONTEXT((aTHX = PL_sharedsv_space));
diff --git a/t/object2.t b/t/object2.t
index 3d795b9..31c3797 100644
--- a/t/object2.t
+++ b/t/object2.t
@@ -17,7 +17,7 @@ use ExtUtils::testlib;
BEGIN {
$| = 1;
- print("1..131\n"); ### Number of tests that will be run ###
+ print("1..133\n"); ### Number of tests that will be run ###
};
use threads;
@@ -445,6 +445,28 @@ ok($destroyed[$ID], 'Scalar object removed from shared scalar');
::ok($count == $n, "remove array object by undef");
}
+# RT #131124
+# Emptying a shared array creates new temp SVs. If there are no spare
+# SVs, a new arena is allocated. shared.xs was mallocing a new arena
+# with the wrong perl context set, meaning that when the arena was later
+# freed, it would "panic: realloc from wrong pool"
+#
+
+{
+ threads->new(sub {
+ my @a :shared;
+ push @a, bless &threads::shared::share({}) for 1..1000;
+ undef @a; # this creates lots of temp SVs
+ })->join;
+ ok(1, "#131124 undef array doesnt panic");
+
+ threads->new(sub {
+ my @a :shared;
+ push @a, bless &threads::shared::share({}) for 1..1000;
+ @a = (); # this creates lots of temp SVs
+ })->join;
+ ok(1, "#131124 clear array doesnt panic");
+}
# EOF
--
2.9.3

View File

@ -0,0 +1,110 @@
From 2ec58402d05eb12d0b9387963941f1e445d9aa5b Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Fri, 26 Apr 2019 15:00:30 +0200
Subject: [PATCH] Upgrade to 1.60
---
lib/threads/shared.pm | 4 ++--
shared.xs | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index f7e5ff8..45ad154 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -8,7 +8,7 @@ use Config;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.59'; # Please update the pod, too.
+our $VERSION = '1.60'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.59
+This document describes threads::shared version 1.60
=head1 SYNOPSIS
diff --git a/shared.xs b/shared.xs
index d0f7d1e..6cdf094 100644
--- a/shared.xs
+++ b/shared.xs
@@ -115,6 +115,17 @@
* without the prefix (e.g., sv, tmp or obj).
*/
+/* this is lower overhead than warn() and less likely to interfere
+ with other parts of perl (like with the debugger.)
+*/
+#ifdef SHARED_TRACE_LOCKS
+# define TRACE_LOCK(x) DEBUG_U(x)
+# define TRACE_LOCKv(x) DEBUG_Uv(x)
+#else
+# define TRACE_LOCK(x)
+# define TRACE_LOCKv(x)
+#endif
+
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
@@ -211,8 +222,24 @@ recursive_lock_release(pTHX_ recursive_lock_t *lock)
if (--lock->locks == 0) {
lock->owner = NULL;
COND_SIGNAL(&lock->cond);
+ TRACE_LOCK(
+ PerlIO_printf(Perl_debug_log, "shared lock released %p for %p at %s:%d\n",
+ lock, aTHX, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
+ }
+ else {
+ TRACE_LOCKv(
+ PerlIO_printf(Perl_debug_log, "shared lock unbump %p for %p at %s:%d\n",
+ lock, aTHX, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
}
}
+ else {
+ TRACE_LOCK(
+ PerlIO_printf(Perl_debug_log, "bad shared lock release %p for %p (owned by %p) at %s:%d\n",
+ lock, aTHX, lock->owner, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
+ }
MUTEX_UNLOCK(&lock->mutex);
}
@@ -224,8 +251,16 @@ recursive_lock_acquire(pTHX_ recursive_lock_t *lock, const char *file, int line)
assert(aTHX);
MUTEX_LOCK(&lock->mutex);
if (lock->owner == aTHX) {
+ TRACE_LOCKv(
+ PerlIO_printf(Perl_debug_log, "shared lock bump %p (%p) at %s:%d\n",
+ lock, lock->owner, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
lock->locks++;
} else {
+ TRACE_LOCK(
+ PerlIO_printf(Perl_debug_log, "shared lock try %p for %p (owned by %p) at %s:%d\n",
+ lock, aTHX, lock->owner, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
while (lock->owner) {
#ifdef DEBUG_LOCKS
Perl_warn(aTHX_ " %p waiting - owned by %p %s:%d\n",
@@ -233,6 +268,10 @@ recursive_lock_acquire(pTHX_ recursive_lock_t *lock, const char *file, int line)
#endif
COND_WAIT(&lock->cond,&lock->mutex);
}
+ TRACE_LOCK(
+ PerlIO_printf(Perl_debug_log, "shared lock got %p at %s:%d\n",
+ lock, CopFILE(PL_curcop), CopLINE(PL_curcop))
+ );
lock->locks = 1;
lock->owner = aTHX;
#ifdef DEBUG_LOCKS
--
2.20.1

View File

@ -0,0 +1,57 @@
From c48ee9c79eb7c4a36b7758fc4c3209ca0e5d759b Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Tue, 21 Apr 2020 12:52:31 +0200
Subject: [PATCH] Upgrade to 1.61
---
lib/threads/shared.pm | 4 ++--
t/stress.t | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index 45ad154..bd0e437 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -8,7 +8,7 @@ use Config;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.60'; # Please update the pod, too.
+our $VERSION = '1.61'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.60
+This document describes threads::shared version 1.61
=head1 SYNOPSIS
diff --git a/t/stress.t b/t/stress.t
index 1dd95e3..ccdeb0e 100644
--- a/t/stress.t
+++ b/t/stress.t
@@ -12,7 +12,7 @@ BEGIN {
exit(0);
}
- # http://lists.alioth.debian.org/pipermail/perl-maintainers/2011-June/002285.html
+ # https://lists.alioth.debian.org/pipermail/perl-maintainers/2011-June/002285.html
# There _is_ TLS support on m68k, but this stress test is overwhelming
# for the hardware
if ($^O eq 'linux' && $Config{archname} =~ /^m68k/) {
@@ -179,7 +179,7 @@ use threads::shared;
} elsif ($timeouts) {
# Frequently fails under MSWin32 due to deadlocking bug in Windows
# hence test is TODO under MSWin32
- # http://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
+ # https://rt.perl.org/rt3/Public/Bug/Display.html?id=41574
# http://support.microsoft.com/kb/175332
if ($^O eq 'MSWin32') {
print("not ok 1 # TODO - not reliable under MSWin32\n")
--
2.21.1

View File

@ -0,0 +1,57 @@
From b52cdd7a8525325deba04554d8a00a578c397d56 Mon Sep 17 00:00:00 2001
From: David Mitchell <davem@iabyn.com>
Date: Thu, 11 Jul 2019 15:17:48 +0100
Subject: [PATCH] threads::shared: fix leak
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When assigning a shared reference value to a variable containing a
shared string, the PV buffer in the shared space was leaked. For
example:
my $s :shared = "foo";
my $t :shared = shared_clone(\"bar");
$s = $t; # "foo" in shared space leaked
This was showing up as failed smokes under ASan.
Petr Písař: Ported to 1.60 from perl commit
59c73bd3d62c5096a6f9b2e3cbe05e1ab4c158cf.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
shared.xs | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/shared.xs b/shared.xs
index 6cdf094..858c6d6 100644
--- a/shared.xs
+++ b/shared.xs
@@ -818,12 +818,19 @@ sharedsv_scalar_store(pTHX_ SV *sv, SV *ssv)
SV *obj = SvRV(sv);
SV *sobj = Perl_sharedsv_find(aTHX_ obj);
if (sobj) {
+ SV* tmpref;
SHARED_CONTEXT;
- (void)SvUPGRADE(ssv, SVt_RV);
- sv_setsv_nomg(ssv, &PL_sv_undef);
+ /* Creating a tmp ref to sobj then assigning it to ssv ensures
+ * that any previous contents of ssv are correctly freed
+ * by sv_setsv(). Not sure if there is a better, API-legal way
+ * to achieve this */
+ tmpref = newSV_type(SVt_RV);
+ SvRV_set(tmpref, sobj);
+ SvROK_on(tmpref);
+ SvREFCNT_inc_simple_NN(sobj);
+ sv_setsv_nomg(ssv, tmpref);
+ SvREFCNT_dec_NN(tmpref);
- SvRV_set(ssv, SvREFCNT_inc(sobj));
- SvROK_on(ssv);
if (SvOBJECT(sobj)) {
/* Remove any old blessing */
SvREFCNT_dec(SvSTASH(sobj));
--
2.20.1

View File

@ -0,0 +1,48 @@
From 25d469721e26fbc7afd670776ae9523013e9fdf5 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 6 May 2021 10:38:30 +0200
Subject: [PATCH] Upgrade to 1.62
---
lib/threads/shared.pm | 4 ++--
shared.xs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index bd0e437..3674d83 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -8,7 +8,7 @@ use Config;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.61'; # Please update the pod, too.
+our $VERSION = '1.62'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.61
+This document describes threads::shared version 1.62
=head1 SYNOPSIS
diff --git a/shared.xs b/shared.xs
index 858c6d6..4931a61 100644
--- a/shared.xs
+++ b/shared.xs
@@ -1183,7 +1183,7 @@ sharedsv_array_mg_free(pTHX_ SV *sv, MAGIC *mg)
* This is called when perl is about to access an element of
* the array -
*/
-#if PERL_VERSION >= 11
+#if PERL_VERSION_GE(5,11,0)
static int
sharedsv_array_mg_copy(pTHX_ SV *sv, MAGIC* mg,
SV *nsv, const char *name, I32 namlen)
--
2.30.2

View File

@ -0,0 +1,154 @@
From ff20adba57602ad3ae936eff6718f354d7352f1d Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 12 May 2022 14:53:08 +0200
Subject: [PATCH] Upgrade to 1.64
---
lib/threads/shared.pm | 4 +--
shared.xs | 23 +++++++-------
t/pod.t | 70 -------------------------------------------
3 files changed, 13 insertions(+), 84 deletions(-)
delete mode 100644 t/pod.t
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index 3674d83..1fd2899 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -8,7 +8,7 @@ use Config;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.62'; # Please update the pod, too.
+our $VERSION = '1.64'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.62
+This document describes threads::shared version 1.64
=head1 SYNOPSIS
diff --git a/shared.xs b/shared.xs
index 4931a61..6a7f03c 100644
--- a/shared.xs
+++ b/shared.xs
@@ -824,10 +824,7 @@ sharedsv_scalar_store(pTHX_ SV *sv, SV *ssv)
* that any previous contents of ssv are correctly freed
* by sv_setsv(). Not sure if there is a better, API-legal way
* to achieve this */
- tmpref = newSV_type(SVt_RV);
- SvRV_set(tmpref, sobj);
- SvROK_on(tmpref);
- SvREFCNT_inc_simple_NN(sobj);
+ tmpref = newRV_inc(sobj);
sv_setsv_nomg(ssv, tmpref);
SvREFCNT_dec_NN(tmpref);
@@ -1296,14 +1293,16 @@ static void
Perl_sharedsv_init(pTHX)
{
dTHXc;
- PL_sharedsv_space = perl_alloc();
- perl_construct(PL_sharedsv_space);
- /* The pair above leaves us in shared context (what dTHX would get),
- * but aTHX still points to caller context */
- aTHX = PL_sharedsv_space;
- LEAVE; /* This balances the ENTER at the end of perl_construct. */
- PERL_SET_CONTEXT((aTHX = caller_perl));
- recursive_lock_init(aTHX_ &PL_sharedsv_lock);
+ if (!PL_sharedsv_space) {
+ PL_sharedsv_space = perl_alloc();
+ perl_construct(PL_sharedsv_space);
+ /* The pair above leaves us in shared context (what dTHX would get),
+ * but aTHX still points to caller context */
+ aTHX = PL_sharedsv_space;
+ LEAVE; /* This balances the ENTER at the end of perl_construct. */
+ PERL_SET_CONTEXT((aTHX = caller_perl));
+ recursive_lock_init(aTHX_ &PL_sharedsv_lock);
+ }
PL_lockhook = &Perl_sharedsv_locksv;
PL_sharehook = &Perl_sharedsv_share;
#ifdef PL_destroyhook
diff --git a/t/pod.t b/t/pod.t
deleted file mode 100644
index 5d0cb42..0000000
--- a/t/pod.t
+++ /dev/null
@@ -1,70 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-if ($ENV{RUN_MAINTAINER_TESTS}) {
- plan 'tests' => 3;
-} else {
- plan 'skip_all' => 'Module maintainer tests';
-}
-
-SKIP: {
- if (! eval 'use Test::Pod 1.26; 1') {
- skip('Test::Pod 1.26 required for testing POD', 1);
- }
-
- pod_file_ok('lib/threads/shared.pm');
-}
-
-SKIP: {
- if (! eval 'use Test::Pod::Coverage 1.08; 1') {
- skip('Test::Pod::Coverage 1.08 required for testing POD coverage', 1);
- }
-
- pod_coverage_ok('threads::shared',
- {
- 'trustme' => [
- ],
- 'private' => [
- qr/^import$/,
- ]
- }
- );
-}
-
-SKIP: {
- if (! eval 'use Test::Spelling; 1') {
- skip('Test::Spelling required for testing POD spelling', 1);
- }
- if (system('aspell help >/dev/null 2>&1')) {
- skip("'aspell' required for testing POD spelling", 1);
- }
- set_spell_cmd('aspell list --lang=en');
- add_stopwords(<DATA>);
- pod_file_spelling_ok('lib/threads/shared.pm', 'shared.pm spelling');
- unlink("/home/$ENV{'USER'}/en.prepl", "/home/$ENV{'USER'}/en.pws");
-}
-
-exit(0);
-
-__DATA__
-
-Artur
-Hedden
-
-cpan
-CPAN
-CONDVAR
-LOCKVAR
-refcnt
-variable's
-destructor
-destructors
-Destructors
-
-perlfunc
-dualvar
-SV
-
-MetaCPAN
-__END__
--
2.34.3

View File

@ -0,0 +1,90 @@
From dca84f1765496c5beb5ac418286c588eb8c268d9 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 18 May 2023 19:26:24 +0200
Subject: [PATCH] Upgrade to 1.68
---
lib/threads/shared.pm | 4 ++--
shared.xs | 21 +++++++++------------
2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/lib/threads/shared.pm b/lib/threads/shared.pm
index 1fd2899..6e67acd 100644
--- a/lib/threads/shared.pm
+++ b/lib/threads/shared.pm
@@ -8,7 +8,7 @@ use Config;
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.64'; # Please update the pod, too.
+our $VERSION = '1.68'; # Please update the pod, too.
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -196,7 +196,7 @@ threads::shared - Perl extension for sharing data structures between threads
=head1 VERSION
-This document describes threads::shared version 1.64
+This document describes threads::shared version 1.68
=head1 SYNOPSIS
diff --git a/shared.xs b/shared.xs
index 6a7f03c..f78542d 100644
--- a/shared.xs
+++ b/shared.xs
@@ -40,7 +40,7 @@
* proxy PVLV element with attached element magic.
*
* Pointers to the shared SV are squirrelled away in the mg->mg_ptr field
- * of magic (with mg_len == 0), and in the IV2PTR(SvIV(sv)) field of tied
+ * of magic (with mg_len == 0), and in the INT2PTR(SvIV(sv)) field of tied
* object SVs. These pointers have to be hidden like this because they
* cross interpreter boundaries, and we don't want sv_clear() and friends
* following them.
@@ -130,14 +130,11 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
-#ifdef HAS_PPPORT_H
-# define NEED_sv_2pv_flags
-# define NEED_vnewSVpvf
-# define NEED_warner
-# define NEED_newSVpvn_flags
-# include "ppport.h"
-# include "shared.h"
-#endif
+#define NEED_sv_2pv_flags
+#define NEED_vnewSVpvf
+#define NEED_warner
+#define NEED_newSVpvn_flags
+#include "ppport.h"
#ifndef CLANG_DIAG_IGNORE
# define CLANG_DIAG_IGNORE(x)
@@ -704,10 +701,10 @@ Perl_sharedsv_cond_timedwait(perl_cond *cond, perl_mutex *mut, double abs)
abs -= (NV)ts.tv_sec;
ts.tv_nsec = (long)(abs * 1000000000.0);
- CLANG_DIAG_IGNORE_STMT(-Wthread-safety);
+ CLANG_DIAG_IGNORE(-Wthread-safety)
/* warning: calling function 'pthread_cond_timedwait' requires holding mutex 'mut' exclusively [-Wthread-safety-analysis] */
switch (pthread_cond_timedwait(cond, mut, &ts)) {
- CLANG_DIAG_RESTORE_STMT;
+ CLANG_DIAG_RESTORE
case 0: got_it = 1; break;
case ETIMEDOUT: break;
@@ -1145,7 +1142,7 @@ sharedsv_array_mg_CLEAR(pTHX_ SV *sv, MAGIC *mg)
I32 items = isav ? AvFILLp((AV *)ssv) + 1 : 0;
HE *iter;
if (!isav) hv_iterinit((HV *)ssv);
- while (isav ? items-- : !!(iter = hv_iternext((HV *)ssv))) {
+ while (isav ? items-- : cBOOL(iter = hv_iternext((HV *)ssv))) {
SV *sv = isav ? *svp++ : HeVAL(iter);
if (!sv) continue;
if ( (SvOBJECT(sv) || (SvROK(sv) && (sv = SvRV(sv))))
--
2.40.1