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


Groups > gnu.bash.bug > #14892

'local -' disables alias expansion in scripts

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From PJ Eby <pje@telecommunity.com>
Newsgroups gnu.bash.bug
Subject 'local -' disables alias expansion in scripts
Date Tue, 4 Dec 2018 15:38:52 -0500
Lines 43
Approved bug-bash@gnu.org
Message-ID <mailman.5165.1543956478.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1543956478 23007 208.118.235.17 (4 Dec 2018 20:47:58 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-Gm-Message-State AA+aEWYPQlQMid1jYyCuLQs9hvUM6e4EiPjd5vx3LzNUZO0V1vPY6zAR AMlsiRqGBbKtZXrq45vWNIB/DbczbqAqw8di8w==
X-Google-Smtp-Source AFSGD/WteRdzOLrWTLWeE1AF9z1+0TAWBExKPYFRIEXkyHxYBQb7/dwyFrg5yC48KCHzvCAa5tBibpK0xD/Tvq0msv0=
X-Received by 2002:aca:6245:: with SMTP id w66mr13806831oib.9.1543955946748; Tue, 04 Dec 2018 12:39:06 -0800 (PST)
X-Gmail-Original-Message-ID <CALeMXf5RgqoOMfkf_BshhqPzAQnVJQGrmecCQLUJBnn12++Usw@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x [fuzzy]
X-Received-From 209.190.5.234
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14892

Show key headers only | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web