Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] estack.eclass: Properly restore shopt options.
Date: Sat, 23 Nov 2019 11:04:21
Message-Id: w6gpnhikg60.fsf@kph.uni-mainz.de
1 Calling "eshopts_push; eshopts_pop" makes Portage report a QA issue:
2 * QA Notice: Global shell options changed and were not restored while calling 'src_prepare'
3
4 This is caused by some side effect, by which restoring the noglob
5 option disables the expand_aliases option. Work around the problem
6 by always saving and restoring both "set -o" and "shopt" option sets.
7
8 Also fix "estack_push -s" which should not execute shopt when called
9 without further parameters.
10
11 Closes: https://bugs.gentoo.org/662586
12 Signed-off-by: Ulrich Müller <ulm@g.o>
13 ---
14 eclass/estack.eclass | 9 +++++----
15 1 file changed, 5 insertions(+), 4 deletions(-)
16
17 diff --git a/eclass/estack.eclass b/eclass/estack.eclass
18 index f548abf8c283..b0177bdb358e 100644
19 --- a/eclass/estack.eclass
20 +++ b/eclass/estack.eclass
21 @@ -1,4 +1,4 @@
22 -# Copyright 1999-2017 Gentoo Foundation
23 +# Copyright 1999-2019 Gentoo Authors
24 # Distributed under the terms of the GNU General Public License v2
25
26 # @ECLASS: estack.eclass
27 @@ -153,12 +153,13 @@ evar_pop() {
28 # eshopts_pop
29 # @CODE
30 eshopts_push() {
31 + # Save both "shopt" and "set -o" option sets, because otherwise
32 + # restoring noglob would disable expand_aliases by side effect. #662586
33 + estack_push eshopts "$(shopt -p -o) $(shopt -p)"
34 if [[ $1 == -[su] ]] ; then
35 - estack_push eshopts "$(shopt -p)"
36 - [[ $# -eq 0 ]] && return 0
37 + [[ $# -le 1 ]] && return 0
38 shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*"
39 else
40 - estack_push eshopts "$(shopt -p -o)"
41 [[ $# -eq 0 ]] && return 0
42 set "$@" || die "${FUNCNAME}: bad options to set: $*"
43 fi
44 --
45 2.24.0

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
[gentoo-dev] [PATCH] estack.eclass: Drop isdigit function. "Ulrich Müller" <ulm@g.o>