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


Groups > gnu.bash.bug > #15630

Saving/restoring of posix option unsets expand_aliases

From Ulrich Mueller <ulm@gentoo.org>
Newsgroups gnu.bash.bug
Subject Saving/restoring of posix option unsets expand_aliases
Date 2019-11-24 13:35 +0100
Message-ID <mailman.2496.1574598945.13325.bug-bash@gnu.org> (permalink)
References <w6g1rtxjvuf.fsf@kph.uni-mainz.de>

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -march=native -ggdb -O2 -pipe -Wno-parentheses -Wno-format-security
uname output: Linux themis 4.14.154-gentoo #1 SMP Sat Nov 16 15:00:00 CET 2019 x86_64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 11
Release Status: release

Description:
In a non-interactive non-posix-mode shell, saving the output of
"shopt -p -o" and restoring it will unset the expand_aliases option.

Repeat-By:
Execute the following script:

   #!/bin/bash
   shopt -s expand_aliases
   save=$(shopt -p -o)
   shopt -p expand_aliases
   eval "${save}"
   shopt -p expand_aliases

Here, its output is:

   shopt -s expand_aliases
   shopt -u expand_aliases

AFAICS, this is caused by eval unsetting the "posix" option (even though
it wasn't set before). Function set_posix_mode calls sv_strict_posix,
which in turn calls posix_initialize, which sets expand_aliases and
other options.

Expected behavior: Saving and restoring of options shouldn't change
other options by side effect.

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


Thread

Saving/restoring of posix option unsets expand_aliases Ulrich Mueller <ulm@gentoo.org> - 2019-11-24 13:35 +0100

csiph-web