Fix SIGPIPE subshell regression

Resolves: RHEL-92646
This commit is contained in:
Vincent Mihalkovic 2025-07-09 12:57:38 +02:00
parent c042fb057d
commit 1a97ce3ed5
2 changed files with 46 additions and 1 deletions

38
ksh-1.0.10-sigpipe.patch Normal file
View File

@ -0,0 +1,38 @@
From bc56018765163a8059600f5205e9e2b1f4059873 Mon Sep 17 00:00:00 2001
From: Martijn Dekker <martijn@inlv.org>
Date: Sat, 20 Jul 2024 01:40:35 +0100
Subject: [PATCH] Re-fix SIGPIPE subshell regression (re: 227c6379, 4df6d674)
It was committed prematurely and still broken on most systems.
src/cmd/ksh93/sh/fault.c: sh_done():
- Revert changes.
src/cmd/ksh93/sh/jobs.c: job_wait():
- Do not set sh.chldexitsig in the first place if the signal is
SIGPIPE and we're in a real subshell.
This workaround passes all the tests I can throw at it.
Resolves: https://github.com/ksh93/ksh/issues/765
---
src/cmd/ksh93/sh/jobs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c
index f8c4d5f..580dae0 100644
--- a/src/cmd/ksh93/sh/jobs.c
+++ b/src/cmd/ksh93/sh/jobs.c
@@ -1447,7 +1447,8 @@ int job_wait(pid_t pid)
if(px->p_flag&P_SIGNALLED)
{
sh.exitval |= SH_EXITSIG;
- sh.chldexitsig = 1;
+ if(!(sh.realsubshell && px->p_exit==SIGPIPE))
+ sh.chldexitsig = 1;
}
if(intr)
px->p_flag &= ~P_EXITSAVE;
--
2.50.0

View File

@ -4,7 +4,7 @@ URL: http://www.kornshell.com/
License: EPL-1.0
Epoch: 3
Version: 1.0.6
Release: 12%{?dist}
Release: 13%{?dist}
Source0: https://github.com/ksh93/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: kshcomp.conf
Source2: kshrc.rhs
@ -54,6 +54,9 @@ Patch12: ksh-1.0.11-segfault-sigwinch.patch
# upstream commit: https://github.com/ksh93/ksh/commit/a1fcad4bf65fe26a3f9a386b63732ab151ce03ec
Patch13: ksh-1.0.10-blankline.patch
# upstream commit: https://github.com/ksh93/ksh/commit/bc56018765163a8059600f5205e9e2b1f4059873
Patch14: ksh-1.0.10-sigpipe.patch
Conflicts: pdksh
Requires: coreutils, diffutils
BuildRequires: gcc
@ -175,6 +178,10 @@ fi
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
%changelog
* Wed Jul 09 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 3:1.0.6-13
- Fix SIGPIPE subshell regression
Resolves: RHEL-92646
* Mon Jun 02 2025 Vincent Mihalkovic <vmihalko@redhat.com> - 3:1.0.6-12
- Fix recalling lines starting with whitespace
Resolves: RHEL-74464