From 7bc9c63c9da678a7e6fceb095d56c634afd22c56 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 15 Dec 2019 18:09:03 +0000 Subject: gentoo resync : 15.12.2019 --- eclass/estack.eclass | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'eclass/estack.eclass') diff --git a/eclass/estack.eclass b/eclass/estack.eclass index f548abf8c283..3f444ee3b70b 100644 --- a/eclass/estack.eclass +++ b/eclass/estack.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: estack.eclass @@ -115,7 +115,8 @@ evar_pop() { local cnt=${1:-bad} case $# in 0) cnt=1 ;; - 1) isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*" ;; + 1) [[ -z ${cnt//[0-9]} ]] \ + || die "${FUNCNAME}: first arg must be a number: $*" ;; *) die "${FUNCNAME}: only accepts one arg: $*" ;; esac @@ -153,12 +154,13 @@ evar_pop() { # eshopts_pop # @CODE eshopts_push() { + # Save both "shopt" and "set -o" option sets, because otherwise + # restoring posix would disable expand_aliases by side effect. #662586 + estack_push eshopts "$(shopt -p -o) $(shopt -p)" if [[ $1 == -[su] ]] ; then - estack_push eshopts "$(shopt -p)" - [[ $# -eq 0 ]] && return 0 + [[ $# -le 1 ]] && return 0 shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*" else - estack_push eshopts "$(shopt -p -o)" [[ $# -eq 0 ]] && return 0 set "$@" || die "${FUNCNAME}: bad options to set: $*" fi @@ -196,17 +198,5 @@ eumask_pop() { umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}" } -# @FUNCTION: isdigit -# @USAGE: [more numbers] -# @DESCRIPTION: -# Return true if all arguments are numbers. -isdigit() { - local d - for d ; do - [[ ${d:-bad} == *[!0-9]* ]] && return 1 - done - return 0 -} - _ESTACK_ECLASS=1 fi #_ESTACK_ECLASS -- cgit v1.2.3