Path: csiph.com!weretis.net!feeder6.news.weretis.net!feeder7.news.weretis.net!news.unit0.net!fu-berlin.de!usenet.stanford.edu!not-for-mail From: Ulrich Mueller Newsgroups: gnu.bash.bug Subject: Saving/restoring of posix option unsets expand_aliases Date: Sun, 24 Nov 2019 13:35:20 +0100 Lines: 39 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: usenet.stanford.edu 1574598946 16477 209.51.188.17 (24 Nov 2019 12:35:46 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:470:ea4a:1:5054:ff:fec7:86e4 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:15630 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.