From 0b6733889a180571cc86b31a5e640eb122e1ea3a Mon Sep 17 00:00:00 2001
From: Petr Písař <ppi...@redhat.com>
Date: Aug 09 2017 16:03:03 +0000
Subject: Obey to perl's PERL_USE_SAFE_PUTENV default


---

diff --git a/Env-C-0.14-Obey-to-perl-s-PERL_USE_SAFE_PUTENV-default.patch 
b/Env-C-0.14-Obey-to-perl-s-PERL_USE_SAFE_PUTENV-default.patch
new file mode 100644
index 0000000..c2a6814
--- /dev/null
+++ b/Env-C-0.14-Obey-to-perl-s-PERL_USE_SAFE_PUTENV-default.patch
@@ -0,0 +1,56 @@
+From a387f471ab257d48bfb832bcb4bac3f895cfbdda Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
+Date: Wed, 9 Aug 2017 17:55:20 +0200
+Subject: [PATCH] Obey to perl's PERL_USE_SAFE_PUTENV default
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream forces PERL_USE_SAFE_PUTENV because otherwise the code
+crashes somewhere sometimes. But forced PERL_USE_SAFE_PUTENV causes
+memory leaks.
+
+Let's try perl's default. If we are bitten by the crash, we can
+disable the t/leak.t instead.
+
+https://github.com/mschout/env-c/issues/3
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ C.xs | 21 ---------------------
+ 1 file changed, 21 deletions(-)
+
+diff --git a/C.xs b/C.xs
+index cf1e4fc..4002bd6 100644
+--- a/C.xs
++++ b/C.xs
+@@ -27,27 +27,6 @@
+ # endif
+ #endif
+ 
+-/* in order to work around system and perl implementation bugs/leaks, we need
+- * to sometimes force PERL_USE_SAFE_PUTENV mode.
+- */
+-#ifndef PERL_USE_SAFE_PUTENV
+-   /* Threaded perl with PERL_TRACK_MEMPOOL enabled causes
+-    * "panic: free from wrong pool at exit"
+-    * starting at 5.9.4 (confirmed through 5.20.1)
+-    * see: https://rt.cpan.org/Ticket/Display.html?id=99962
+-    */
+-# if PERL_BCDVERSION >= 0x5009004 && defined(USE_ITHREADS) && 
defined(PERL_TRACK_MEMPOOL)
+-#  define USE_SAFE_PUTENV 1
+-# elif PERL_BCDVERSION >= 0x5008000 && PERL_BCDVERSION < 0x5019006
+-   /* FreeBSD: SIGV at exit on perls prior to 5.19.6
+-    * see: https://rt.cpan.org/Ticket/Display.html?id=49872
+-    */
+-#  if defined(__FreeBSD__)
+-#   define USE_SAFE_PUTENV 1
+-#  endif
+-# endif
+-#endif
+-
+ MODULE = Env::C        PACKAGE = Env::C  PREFIX = env_c_
+ 
+ char *
+-- 
+2.9.4
+
diff --git a/perl-Env-C.spec b/perl-Env-C.spec
index 47d4cea..4ef4eb8 100644
--- a/perl-Env-C.spec
+++ b/perl-Env-C.spec
@@ -8,6 +8,10 @@ URL:            http://search.cpan.org/dist/Env-C/
 Source0:        
http://www.cpan.org/authors/id/M/MS/MSCHOUT/Env-C-%{version}.tar.gz
 # Fix compiler warnings, <https://github.com/mschout/env-c/pull/9>
 Patch0:         Env-C-0.14-Fix-compiler-warnings.patch
+# Obey to perl's PERL_USE_SAFE_PUTENV default.
+# If it proves wrong, we will disable t/leak.t instead.
+# <https://github.com/mschout/env-c/issues/3>
+Patch1:         Env-C-0.14-Obey-to-perl-s-PERL_USE_SAFE_PUTENV-default.patch
 BuildRequires:  findutils
 BuildRequires:  make
 BuildRequires:  perl-interpreter
@@ -29,6 +33,7 @@ It also can return all the environ variables.
 %prep
 %setup -q -n Env-C-%{version}
 %patch0 -p1
+%patch1 -p1
 
 %build
 perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1
@@ -52,6 +57,7 @@ make test
 %changelog
 * Wed Aug 09 2017 Petr Pisar <ppi...@redhat.com> - 0.14-5
 - Fix compiler warnings
+- Obey to perl's PERL_USE_SAFE_PUTENV default (bug #1465738)
 
 * Thu Aug 03 2017 Fedora Release Engineering <rel...@fedoraproject.org> - 
0.14-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild


        
https://src.fedoraproject.org/rpms/perl-Env-C/c/0b6733889a180571cc86b31a5e640eb122e1ea3a?branch=master
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org

Reply via email to