What were you trying to do that didn't work?
In case the user unset SHLVL variable then later replaces the shell through executing a command, ksh will segfault:
# unset -v SHLVL # exec bash Segmentation fault (core dumped)
The reason for this is SHLVL variable is getting decremented without any guard making sure it's still in the environment, see ksh-1.0.6/src/cmd/ksh93/bltins/misc.c sources:
70 /* 71 * 'exec' special builtin and 'redirect' builtin 72 */ : 77 int b_exec(int argc,char *argv[], Shbltin_t *context) 78 { : 148 /* if the main shell is about to be replaced, decrease SHLVL to cancel out a subsequent increase */ 149 if(!sh.realsubshell) 150 (*SHLVL->nvalue.ip)--;
What is the impact of this issue to you?
Users unsetting SHLVL in the .profile file cannot login anymore.
This is a regression introduced sometimes after ksh-1.0.0~beta.1-3.el9.
Please provide the package NVR for which the bug is seen:
ksh-1.0.6-3.el9
How reproducible is this bug?:
Always, see above.