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] Remove tilde expansion discipline

Defining a .sh.tilde.get or .sh.tilde.set discipline function to
extend tilde expansion works well as long as the discipline
function doesn't get interrupted (e.g. with Crtl+C) or produce an
error message. Either of those will cause the shell to become
unstable and crash.

This feature is now removed from the 1.0 branch as it is not ready
for prime time. It can return to a release branch if/when we manage
to fix it on the master branch.

Related: https://github.com/ksh93/ksh/issues/346
This commit is contained in:
Martijn Dekker 2021-11-24 07:46:58 +01:00
parent 40de1e92b0
commit c0334e32a1
9 changed files with 1 additions and 134 deletions

View file

@ -2635,23 +2635,7 @@ static void tilde_expand2(Shell_t *shp, register int offset)
char *cp = NIL(char*); /* character pointer for tilde expansion result */
char *stakp = stakptr(0); /* current stack object (&stakp[offset] is tilde string) */
int curoff = staktell(); /* current offset of current stack object */
static char block; /* for disallowing tilde expansion in .get/.set to change ${.sh.tilde} */
/*
* Allow overriding tilde expansion with a .sh.tilde.set or .get discipline function.
*/
if(!block && SH_TILDENOD->nvfun && SH_TILDENOD->nvfun->disc)
{
stakfreeze(1); /* terminate current stack object to avoid data corruption */
block++;
nv_putval(SH_TILDENOD, &stakp[offset], 0);
cp = nv_getval(SH_TILDENOD);
block--;
if(cp[0]=='\0' || cp[0]=='~')
cp = NIL(char*); /* do not use empty or unexpanded result */
stakset(stakp,curoff); /* restore stack to state on function entry */
}
/*
* Perform default tilde expansion unless overridden.
* Write the result to the stack, if any.
*/
stakputc(0);