Auto sync2gitlab import of ksh-20120801-255.el8.src.rpm
This commit is contained in:
parent
94d304104c
commit
cd9fd2352b
47
ksh-20120801-jobcontrol.patch
Normal file
47
ksh-20120801-jobcontrol.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 27909acb584aed231d757d1d63c6c62b57c8e152 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Mihalkovic <vmihalko@redhat.com>
|
||||
Date: Mon, 3 Jan 2022 14:03:20 +0100
|
||||
Subject: [PATCH] Fix race conditions running external commands with job
|
||||
control on
|
||||
|
||||
When ksh is compiled with SHOPT_SPAWN (the default), which uses
|
||||
posix_spawn(3) or vfork(2) (via sh_ntfork()) to launch external
|
||||
commands, at least two race conditions occur when launching
|
||||
external commands while job control is active. See:
|
||||
https://bugs.launchpad.net/ubuntu/+source/ksh/+bug/1887863/comments/3
|
||||
https://www.mail-archive.com/ast-developers@research.att.com/msg00717.html
|
||||
|
||||
The basic issue is that this performance optimisation is
|
||||
incompatible with job control, because it uses a spawning mechanism
|
||||
that doesn't copy the parent process' memory pages into the child
|
||||
process, therefore no state that involves memory can be set before
|
||||
exec-ing the external program. This makes it impossible to
|
||||
correctly set the terminal's process group ID in the child process,
|
||||
something that is essential for job control to work.
|
||||
|
||||
src/cmd/ksh93/sh/xec.c:
|
||||
- Use sh_fork() instead of sh_ntfork() if job control is active.
|
||||
This uses fork(2), which is 30%-ish slower on most sytems, but
|
||||
allows for correctly setting the terminal process group.
|
||||
|
||||
Fixes: https://github.com/ksh93/ksh/issues/79
|
||||
---
|
||||
src/cmd/ksh93/sh/xec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c
|
||||
index ae13178..be57a6b 100644
|
||||
--- a/src/cmd/ksh93/sh/xec.c
|
||||
+++ b/src/cmd/ksh93/sh/xec.c
|
||||
@@ -1737,7 +1737,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||
#else
|
||||
#if SHOPT_SPAWN
|
||||
# ifdef _lib_fork
|
||||
- if(com)
|
||||
+ if(com && !job.jobcontrol)
|
||||
parent = sh_ntfork(shp,t,com,&jobid,ntflag);
|
||||
else
|
||||
parent = sh_fork(shp,type,&jobid);
|
||||
--
|
||||
2.31.1
|
||||
|
9
ksh.spec
9
ksh.spec
@ -6,7 +6,7 @@ Summary: The Original ATT Korn Shell
|
||||
URL: http://www.kornshell.com/
|
||||
License: EPL
|
||||
Version: %{releasedate}
|
||||
Release: 254%{?dist}
|
||||
Release: 255%{?dist}
|
||||
Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{release_date}.tgz
|
||||
Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{release_date}.tgz
|
||||
Source2: kshcomp.conf
|
||||
@ -217,6 +217,9 @@ Patch88: ksh-20120801-annocheck.patch
|
||||
# rhbz#1790547
|
||||
Patch89: ksh-20120801-cve-2019-14868.patch
|
||||
|
||||
# rhbz#1857847
|
||||
Patch90: ksh-20120801-jobcontrol.patch
|
||||
|
||||
Conflicts: pdksh
|
||||
Requires: coreutils, diffutils, chkconfig
|
||||
BuildRequires: bison
|
||||
@ -369,6 +372,10 @@ fi
|
||||
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
||||
|
||||
%changelog
|
||||
* Mon Jan 03 2022 Vincent Mihalkovic <vmihalko@redhat.com> - 20120801-255
|
||||
- Fix race conditions running external commands with job control on
|
||||
Resolves: #1857847
|
||||
|
||||
* Thu Feb 06 2020 Siteshwar Vashisht <svashisht@redhat.com> - 20120801-254
|
||||
- Bump version number to avoid breaking upgrade path
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user