From 59b6a5ddf642da278c3a29901573b32b52bff437 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Thu, 8 Feb 2024 10:35:14 -0800 Subject: [PATCH] Fix ksh lockup after 'arch-chroot' (re: d0c055c1) (#717) In commit d0c055c1 code that was hidden behind '#ifndef SIGTSTP' was accidentally left in the codebase, which causes ksh to lockup after the Arch Linux arch-chroot script starts ksh. Reproducer below (though note that I was using a Debian system to chroot into the Arch installation): # mount /dev/nvme0n1p3 /mnt # mount /dev/nvme0n1p1 /mnt/boot # /mnt/usr/bin/arch-chroot /mnt /bin/ksh src/cmd/ksh93/sh/jobs.c: - Remove leftover code that sets the process group ID in such a way that arch-chroot fails to launch a functional ksh prompt (though for some reason regular chroot isn't affected). This setpgid call was only ever meant to be used on non-POSIX systems that lack SIGTSTP. --- NEWS | 5 +++++ src/cmd/ksh93/include/version.h | 2 +- src/cmd/ksh93/sh/jobs.c | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c45169506bbe..d7693e2340be 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ This documents significant changes in the 1.0 branch of ksh 93u+m. For full details, see the git log at: https://github.com/ksh93/ksh/tree/1.0 Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library. +2024-02-06: + +- Fixed a regression introduced on 2023-03-04 that caused ksh to lock up + after using the Arch Linux arch-chroot script. + 2024-02-03: - Fixed: the arithmetic representation of negative integers with a base other diff --git a/src/cmd/ksh93/include/version.h b/src/cmd/ksh93/include/version.h index 91ff5b698d76..45345dd4a9b6 100644 --- a/src/cmd/ksh93/include/version.h +++ b/src/cmd/ksh93/include/version.h @@ -18,7 +18,7 @@ #define SH_RELEASE_FORK "93u+m" /* only change if you develop a new ksh93 fork */ #define SH_RELEASE_SVER "1.0.9-beta" /* semantic version number: https://semver.org */ -#define SH_RELEASE_DATE "2024-02-03" /* must be in this format for $((.sh.version)) */ +#define SH_RELEASE_DATE "2024-02-06" /* must be in this format for $((.sh.version)) */ #define SH_RELEASE_CPYR "(c) 2020-2024 Contributors to ksh " SH_RELEASE_FORK /* Scripts sometimes field-split ${.sh.version}, so don't change amount of whitespace. */ diff --git a/src/cmd/ksh93/sh/jobs.c b/src/cmd/ksh93/sh/jobs.c index 4958daa21f30..f85cb2b1c054 100644 --- a/src/cmd/ksh93/sh/jobs.c +++ b/src/cmd/ksh93/sh/jobs.c @@ -553,7 +553,6 @@ void job_init(int lflag) /* This should have already been done by rlogin */ int fd; char *ttynam; - setpgid(0,sh.pid); if(job.mypgid<0 || !(ttynam=ttyname(JOBTTY))) return; while(close(JOBTTY)<0 && errno==EINTR)