On 12/4/18 3:38 PM, PJ Eby wrote:
> Description:
>
> After a function using 'local -' is invoked in a script, alias
> expansion is disabled, even if it was previously enabled.
>
>
> Repeat-By:
>
> In a script, use shopt -s expand_aliases, then call a function
> containing 'local -'; After the function returns, expand_aliases is
> disabled.
>
> Fix:
>
> The issue appears to be caused by set_posix_mode() in builtins/set.def
> reinitializing posix mode even when its state is unchanged (which
> resets expand_aliases to 0). Not reinitializing this would be a
> possible workaround, but I suspect it would be better to explicitly
> save the state of expand_aliases, as part of
> get_current_options/set_current_options
It's a little bit more complicated, since expand_aliases is just one of the
options modified by posix mode. Maybe a two-step approach is best: revert
posix mode first, as long as it's changed, then process the rest of the
options. That will catch them all, instead of special-casing expand_aliases.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/