att/ast

No-fork bug in subshell.c

krader1961 opened this issue · 1 comments

This statement

if (!(sp->nofork = sh_state(SH_NOFORK))) sh_onstate(shp, SH_NOFORK);

is broken as the condition can never be true since sh_state(SH_NOFORK) always returns a non-zero value. Thus the sh_onstate(shp, SH_NOFORK) will never be executed. So the question is what was intended? This is one of only two places where sh_onstate(shp, SH_NOFORK) appears (the other is in xec.c).

P.S., This same bug exists in the ksh93u+ release.

See also issue #480 and many related issues.