Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14892 > unrolled thread

'local -' disables alias expansion in scripts

Started byPJ Eby <pje@telecommunity.com>
First post2018-12-04 15:38 -0500
Last post2018-12-04 15:38 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

  'local -' disables alias expansion in scripts PJ Eby <pje@telecommunity.com> - 2018-12-04 15:38 -0500

#14892 — 'local -' disables alias expansion in scripts

FromPJ Eby <pje@telecommunity.com>
Date2018-12-04 15:38 -0500
Subject'local -' disables alias expansion in scripts
Message-ID<mailman.5165.1543956478.1284.bug-bash@gnu.org>
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin'  -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-m64 -mtune=generic -Wno-parentheses -Wno-format-security
uname output: Linux wisdom.dirtsimple.org 4.16.7-200.fc27.x86_64 #1
SMP Wed May 2 20:33:31 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.4
Patch Level: 19
Release Status: release

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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web