From 1a97ce3ed59bc5bf0e187d5696c18a7aaff63452 Mon Sep 17 00:00:00 2001 From: Vincent Mihalkovic Date: Wed, 9 Jul 2025 12:57:38 +0200 Subject: [PATCH] Fix SIGPIPE subshell regression Resolves: RHEL-92646 --- ksh-1.0.10-sigpipe.patch | 38 ++++++++++++++++++++++++++++++++++++++ ksh.spec | 9 ++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 ksh-1.0.10-sigpipe.patch diff --git a/ksh-1.0.10-sigpipe.patch b/ksh-1.0.10-sigpipe.patch new file mode 100644 index 0000000..b17b0cd --- /dev/null +++ b/ksh-1.0.10-sigpipe.patch @@ -0,0 +1,38 @@ +From bc56018765163a8059600f5205e9e2b1f4059873 Mon Sep 17 00:00:00 2001 +From: Martijn Dekker +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 + diff --git a/ksh.spec b/ksh.spec index 9a29f85..408b822 100644 --- a/ksh.spec +++ b/ksh.spec @@ -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 - 3:1.0.6-13 +- Fix SIGPIPE subshell regression + Resolves: RHEL-92646 + * Mon Jun 02 2025 Vincent Mihalkovic - 3:1.0.6-12 - Fix recalling lines starting with whitespace Resolves: RHEL-74464