Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 26 Nov 2019 19:24:03
Message-Id: 1574796199.d2cb9490dbee48a32f196d1aa80d7356a99d9fd8.ulm@gentoo
1 commit: d2cb9490dbee48a32f196d1aa80d7356a99d9fd8
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 23 10:18:18 2019 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 26 19:23:19 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2cb9490
7
8 estack.eclass: Properly restore shopt options.
9
10 Calling "eshopts_push; eshopts_pop" makes Portage report a QA issue:
11 * QA Notice: Global shell options changed and were not restored while calling 'src_prepare'
12
13 This is caused by some side effect in bash, by which disabling
14 the "posix" option (even if it was already disabled before) in a
15 non-interactive shell also disables the "expand_aliases" option.
16 Work around the problem by always saving and restoring both "set -o"
17 and "shopt" option sets.
18
19 Also fix "estack_push -s" which should not execute shopt when called
20 without further parameters.
21
22 Closes: https://bugs.gentoo.org/662586
23 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
24
25 eclass/estack.eclass | 9 +++++----
26 1 file changed, 5 insertions(+), 4 deletions(-)
27
28 diff --git a/eclass/estack.eclass b/eclass/estack.eclass
29 index f548abf8c28..b0177bdb358 100644
30 --- a/eclass/estack.eclass
31 +++ b/eclass/estack.eclass
32 @@ -1,4 +1,4 @@
33 -# Copyright 1999-2017 Gentoo Foundation
34 +# Copyright 1999-2019 Gentoo Authors
35 # Distributed under the terms of the GNU General Public License v2
36
37 # @ECLASS: estack.eclass
38 @@ -153,12 +153,13 @@ evar_pop() {
39 # eshopts_pop
40 # @CODE
41 eshopts_push() {
42 + # Save both "shopt" and "set -o" option sets, because otherwise
43 + # restoring noglob would disable expand_aliases by side effect. #662586
44 + estack_push eshopts "$(shopt -p -o) $(shopt -p)"
45 if [[ $1 == -[su] ]] ; then
46 - estack_push eshopts "$(shopt -p)"
47 - [[ $# -eq 0 ]] && return 0
48 + [[ $# -le 1 ]] && return 0
49 shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*"
50 else
51 - estack_push eshopts "$(shopt -p -o)"
52 [[ $# -eq 0 ]] && return 0
53 set "$@" || die "${FUNCNAME}: bad options to set: $*"
54 fi