Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14893
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: 'local -' disables alias expansion in scripts |
| Date | 2018-12-05 13:47 -0500 |
| Message-ID | <mailman.5242.1544035676.1284.bug-bash@gnu.org> (permalink) |
| References | <CALeMXf5RgqoOMfkf_BshhqPzAQnVJQGrmecCQLUJBnn12++Usw@mail.gmail.com> |
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 chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: 'local -' disables alias expansion in scripts Chet Ramey <chet.ramey@case.edu> - 2018-12-05 13:47 -0500
csiph-web