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

[1.0 release prep] Block namespace defs in ksh functions

In 93v-/ksh2020, namespace defs in any function are a syntax error.
This commit blocks namespace defs for ksh functions only, at the
execution level. This follows some of AT&T original intention while
working around some of the known bugs with namespaces.

Related: https://github.com/ksh93/ksh/issues/325
This commit is contained in:
Martijn Dekker 2021-11-24 06:59:39 +01:00
parent e3d91ffa90
commit 40de1e92b0

View file

@ -2481,6 +2481,11 @@ int sh_exec(register const Shnode_t *t, int flags)
errormsg(SH_DICT,ERROR_exit(1),e_ident,fname);
UNREACHABLE();
}
if(shp->st.real_fun)
{
error(ERROR_exit(3),"namespaces cannot be defined in a ksh function scope");
UNREACHABLE();
}
sfputc(stkp,'.');
sfputr(stkp,fname,0);
np = nv_open(stkptr(stkp,offset),shp->var_tree,flags);