1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Improve fix for 'unset -f' in sub-subshell (re: 07faf384, 13c57e4b)

src/cmd/ksh93/bltins/typeset.c:
- Removing the nv_search() call altogether was actually not
  neccessary, I was just searching the wrong tree: instead of
  sh.fun_base, simply search the current sh.fun_tree which has a
  view to all the layered parent subshell copes. It is not going to
  find it in the current subshell tree but will find it in one of
  the parent trees if it exists. The cost of an unnecessary dummy
  is negligible, but so is the cost of this search, and doing it is
  more correct.
This commit is contained in:
Martijn Dekker 2021-04-24 16:27:29 +01:00
parent 24b7fcb771
commit 295cce2c6d

View file

@ -1398,7 +1398,7 @@ static int unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp)
}
else if(troot==shp->alias_tree)
r = 1;
else if(troot==shp->fun_tree && troot!=shp->fun_base)
else if(troot==shp->fun_tree && troot!=shp->fun_base && nv_search(name,shp->fun_tree,0))
nv_open(name,troot,NV_NOSCOPE); /* create dummy virtual subshell node without NV_FUNCTION attribute */
}
sh_popcontext(shp,&buff);