Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If ksh was compiled with -DSHOPT_REGRESS=1, it would immediately segfault on init. After fixing that, another segfault remained that occurred when using the --regress= command line option with an invalid option-argument. The __regress__ builtin allows tracing a few things (see '__regress__ --man' after compiling with -DSHOPT_REGRESS=1, or usage[] in src/cmd/ksh93/bltins/regress.c). It seems of limited use, but at least it can be used/tested now. src/cmd/ksh93/sh/init.c: sh_init(): - Move the call to sh_regress_init() up. The crash on init was caused by geteuid() being intercepted by regress.c before the shp->regress (== sh.regress) pointer was initialised. - The builtin can also be called using a --regress= option-argument on the ksh command line. Before calling b___regress__() to parse that, temporarily change error_info.exit so any usage error calls exit(3) instead of sh_exit(), as the latter assumes a fully defined shell state and this call is done before the shell is fully initialised.
- Loading branch information