1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Report POSIX function or dot script name in error messages

An old annoyance of mine: when an error occurs in a ksh function,
the function name is reported in the error message, but the same is
not done for POSIX functions.

Since POSIX functions are treated as glorified dot scripts,
b_dot_cmd() needs an errorpush() call and an assignment to
error_info.id to make this happen for both POSIX functions and dot
scripts. This is the same thing that sh_funscope() does for ksh
functions. There is now no difference from ksh functions in how
these report errors.

Note that the sh_popcontext() macro includes an errorpop() call, so
that does not need to be added. See fault.h and error.h.
This commit is contained in:
Martijn Dekker 2022-07-21 06:38:27 +02:00
parent 8264d2089a
commit 6afe659690
2 changed files with 5 additions and 0 deletions

3
NEWS
View file

@ -8,6 +8,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- Fixed a bug where a reproducible $RANDOM sequence (after assigning a
specific value to $RANDOM) was influenced by running any external command.
- When an error occurs in a POSIX name() function or a dot script, the
function or script name is now reported in the error message.
2022-07-14:
- Fixed a bug that caused a spurious "Done" message on the interactive shell

View file

@ -305,6 +305,8 @@ int b_dot_cmd(register int n,char *argv[],Shbltin_t *context)
if(np || argv[1])
argsave = sh_argnew(argv,&saveargfor);
sh_pushcontext(&buff,SH_JMPDOT);
errorpush(&buff.err,0);
error_info.id = argv[0];
jmpval = sigsetjmp(buff.buff,0);
if(jmpval == 0)
{