HomeFreeBSD

sh: Ensure OPTIND=1 in subshell without forking does not affect outer env.

Description

sh: Ensure OPTIND=1 in subshell without forking does not affect outer env.

Command substitutions containing a single simple command and here-document
expansion are performed in a subshell environment, but may not fork. Any
modified state of the shell environment should be restored afterward.

The state that OPTIND=1 had been done was not saved and restored here.

Note that the other parts of shellparam need not be saved and restored,
since they are not modified in these situations (a fork is done before such
modifications).

Details

Provenance
jillesAuthored on
Parents
rS293358: MFH r292836:
Branches
Unknown
Tags
Unknown