Commit 495cdf7b authored by Dominic Hargreaves's avatar Dominic Hargreaves
Browse files

Include upstream patches fixing piped open (Closes: #916313)

parents 1ffb9f3d 52cc7044
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
# see git-dpm(1) from git-dpm package
428a86833a1016bd9f5e7db65e6b5aa3a6bbbabd
428a86833a1016bd9f5e7db65e6b5aa3a6bbbabd
52cc704410ed52d2fc87fbc057bbe66021e6663f
52cc704410ed52d2fc87fbc057bbe66021e6663f
533cd3622b6a61a362e7538a26e25b244ca799f2
533cd3622b6a61a362e7538a26e25b244ca799f2
perl_5.28.1.orig.tar.xz
+6 −0
Original line number Diff line number Diff line
perl (5.28.1-4) UNRELEASED; urgency=medium

  * Include upstream patches fixing piped open (Closes: #916313)

 -- Dominic Hargreaves <dom@earth.li>  Tue, 01 Jan 2019 16:20:52 +0000

perl (5.28.1-3) unstable; urgency=low

  [ Dominic Hargreaves ]
+40 −0
Original line number Diff line number Diff line
From 672eb4519553b7fe3bb96ef70274d19b4d4dbead Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sat, 15 Dec 2018 19:08:41 +0100
Subject: Always mark pipe in pipe-open as inherit-on-exec

Since 2cdf406a a lot of file descriptors are opened close-on-exec,
including the pipe that is passed to the child process in a pipe-open.
This is usually fine because a dup2 follows to rename that handle to
stdin/stdout that will set the inherit-on-exec. However, if the pipe
descriptor already has the right value, for example because stdin was
closed, then no dup2 happens and hence it's still marked as
close-on-exec right when we want to perform an exec.

This patch explicitly marks such a handle as inherit-on-exec, to ensure
it will be open for the child process.

Bug-Debian: https://bugs.debian.org/916313
Bug: https://rt.perl.org/Ticket/Display.html?id=133726
Origin: upstream
Patch-Name: fixes/pipe-open-bugfix/part1.diff
---
 util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util.c b/util.c
index 842cc953e2..17dfda9bc7 100644
--- a/util.c
+++ b/util.c
@@ -2441,8 +2441,10 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode)
 	    if (p[THAT] != (*mode == 'r'))	/* if dup2() didn't close it */
 		PerlLIO_close(p[THAT]);
 	}
-	else
+	else {
+	    setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
 	    PerlLIO_close(p[THAT]);
+	}
 #ifndef OS2
 	if (doexec) {
 #if !defined(HAS_FCNTL) || !defined(F_SETFD)
+32 −0
Original line number Diff line number Diff line
From 52cc704410ed52d2fc87fbc057bbe66021e6663f Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Sun, 16 Dec 2018 01:05:06 +0100
Subject: Always mark pipe in list pipe-open as inherit-on-exec

This is the my_popen_list counterpart of
c6fe5b981b942ddabb23ed4b7602067e906e6d88

Bug-Debian: https://bugs.debian.org/916313
Bug: https://rt.perl.org/Ticket/Display.html?id=133726
Origin: upstream
Patch-Name: fixes/pipe-open-bugfix/part2.diff
---
 util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util.c b/util.c
index 17dfda9bc7..25b5c6601e 100644
--- a/util.c
+++ b/util.c
@@ -2302,8 +2302,10 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args)
 	    if (p[THAT] != (*mode == 'r'))	/* if dup2() didn't close it */
 		PerlLIO_close(p[THAT]);	/* close parent's end of _the_ pipe */
 	}
-	else
+	else {
+	    setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
 	    PerlLIO_close(p[THAT]);	/* close parent's end of _the_ pipe */
+        }
 #if !defined(HAS_FCNTL) || !defined(F_SETFD)
 	/* No automatic close - do it by hand */
 #  ifndef NOFILE
+2 −0
Original line number Diff line number Diff line
@@ -55,3 +55,5 @@ fixes/inplace-editing-bugfix/part1.diff
fixes/inplace-editing-bugfix/part2.diff
fixes/inplace-editing-bugfix/part3.diff
fixes/fix-manifest-failures.diff
fixes/pipe-open-bugfix/part1.diff
fixes/pipe-open-bugfix/part2.diff
Loading