Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ This documents significant changes in the dev branch of ksh 93u+m.
For full details, see the git log at: https://github.com/ksh93/ksh
Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library.

2025-06-16:

- Fixed a regression occurring on systems with glibc 2.35+ that could
cause the pty regression tests to crash or lockup.

2025-06-14:

- Fixed a bug occurring on systems with posix_spawn(3), spawnve(2), and
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <ast_release.h>
#include "git.h"

#define SH_RELEASE_DATE "2025-06-14" /* must be in this format for $((.sh.version)) */
#define SH_RELEASE_DATE "2025-06-16" /* must be in this format for $((.sh.version)) */
/*
* This comment keeps SH_RELEASE_DATE a few lines away from SH_RELEASE_SVER to avoid
* merge conflicts when cherry-picking dev branch commits onto a release branch.
Expand Down
54 changes: 7 additions & 47 deletions src/cmd/ksh93/sh/xec.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
# include <sys/resource.h>
#endif

#undef _use_ntfork_tcpgrp
#if SHOPT_SPAWN && _lib_posix_spawn > 1 && _lib_posix_spawn_file_actions_addtcsetpgrp_np
#define _use_ntfork_tcpgrp 1
#endif

#if SHOPT_SPAWN
static pid_t sh_ntfork(const Shnode_t*,char*[],int*,int);
#endif /* SHOPT_SPAWN */
Expand Down Expand Up @@ -1437,11 +1432,7 @@ int sh_exec(const Shnode_t *t, int flags)
fifo_save_ppid = sh.current_pid;
#endif
#if SHOPT_SPAWN
#if _use_ntfork_tcpgrp
if(com)
#else
if(com && !job.jobcontrol)
#endif /* _use_ntfork_tcpgrp */
{
parent = sh_ntfork(t,com,&jobid,topfd);
if(parent<0)
Expand Down Expand Up @@ -3273,9 +3264,12 @@ static void sigreset(int mode)
}

/*
* A combined fork/exec for systems with slow fork().
* Incompatible with job control on interactive shells (job.jobcontrol) if
* the system does not support posix_spawn_file_actions_addtcsetpgrp_np().
* A combined fork/exec which utilizes libast spawnveg(3) for better performance.
* The spawnveg function will invoke posix_spawn(3) or an equivalent if possible,
* and will fallback to fork(2) if absolutely necessary. For simple command
* execution this codepath is prefered because it's always a bit faster than
* the sh_fork() codepath, even when the underlying system calls it uses wind up
* being the same.
*/
static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd)
{
Expand All @@ -3286,9 +3280,6 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd)
char **arge, *path;
volatile pid_t grp = 0;
Pathcomp_t *pp;
#if _use_ntfork_tcpgrp
volatile int jobwasset=0;
#endif /* _use_ntfork_tcpgrp */
sh_pushcontext(buffp,SH_JMPCMD);
errorpush(&buffp->err,ERROR_SILENT);
job_lock(); /* errormsg will unlock */
Expand Down Expand Up @@ -3340,22 +3331,13 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd)
}
arge = sh_envgen();
sh.exitval = 0;
#if _use_ntfork_tcpgrp
if(job.jobcontrol)
{
signal(SIGTTIN,SIG_DFL);
signal(SIGTTOU,SIG_DFL);
signal(SIGTSTP,SIG_DFL);
jobwasset++;
}
if(sh_isstate(SH_MONITOR) && job.jobcontrol)
{
if(job.curpgid==0)
grp = 1;
else
grp = job.curpgid;
}
#endif /* _use_ntfork_tcpgrp */

sfsync(NULL);
sigreset(0); /* set signals to ignore */
Expand All @@ -3370,19 +3352,8 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd)
job_fork(-2);
if(spawnpid == -1)
{
#if _use_ntfork_tcpgrp
if(jobwasset)
{
signal(SIGTTIN,SIG_IGN);
signal(SIGTTOU,SIG_IGN);
if(sh_isstate(SH_INTERACTIVE))
signal(SIGTSTP,SIG_IGN);
else
signal(SIGTSTP,SIG_DFL);
}
if(job.jobcontrol)
tcsetpgrp(job.fd,sh.pid);
#endif /* _use_ntfork_tcpgrp */
tcsetpgrp(job.fd,sh.pid); /* if spawnveg set tcpgrp, we must restore it ourselves */
switch(errno=sh.path_err)
{
case ENOENT:
Expand All @@ -3405,17 +3376,6 @@ static pid_t sh_ntfork(const Shnode_t *t,char *argv[],int *jobid,int topfd)
sh_popcontext(buffp);
if(buffp->olist)
free_list(buffp->olist);
#if _use_ntfork_tcpgrp
if(jobwasset)
{
signal(SIGTTIN,SIG_IGN);
signal(SIGTTOU,SIG_IGN);
if(sh_isstate(SH_INTERACTIVE))
signal(SIGTSTP,SIG_IGN);
else
signal(SIGTSTP,SIG_DFL);
}
#endif /* _use_ntfork_tcpgrp */
if(sigwasset)
sigreset(1); /* restore ignored signals */
if(scope)
Expand Down
1 change: 1 addition & 0 deletions src/lib/libast/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,7 @@ make install virtual

make spawnveg.o
make comp/spawnveg.c
prev ast_fcntl.h
prev ast_tty.h
prev sig.h
prev include/wait.h
Expand Down
Loading