Gentoo Archives: gentoo-portage-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] isolated-functions.sh: Do not define any aliases.
Date: Mon, 05 Nov 2018 20:21:18
Message-Id: w6gh8gv2s45.fsf@kph.uni-mainz.de
1 save_IFS and restore_IFS are the only aliases that Portage defines,
2 and they are used exactly once. Rewrite __source_all_bashrcs() not to
3 depend on them, and remove their definitions.
4
5 The intention is to drop the expand_aliases shell option at some time
6 in the future.
7
8 Signed-off-by: Ulrich Müller <ulm@g.o>
9 ---
10 bin/ebuild.sh | 8 ++------
11 bin/isolated-functions.sh | 2 --
12 2 files changed, 2 insertions(+), 8 deletions(-)
13
14 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
15 index 5491c4f58..00524d019 100755
16 --- a/bin/ebuild.sh
17 +++ b/bin/ebuild.sh
18 @@ -421,13 +421,9 @@ __source_all_bashrcs() {
19
20 if [[ $EBUILD_PHASE != depend ]] ; then
21 # source the existing profile.bashrcs.
22 - save_IFS
23 - IFS=$'\n'
24 - local bashenv_files=($PORTAGE_BASHRC_FILES)
25 - restore_IFS
26 - for x in "${bashenv_files[@]}" ; do
27 + while read -r x; do
28 __try_source "${x}"
29 - done
30 + done <<<"${PORTAGE_BASHRC_FILES}"
31 fi
32
33 # The user's bashrc is the ONLY non-portage bit of code
34 diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
35 index 39b0ad344..22a6dbb0f 100644
36 --- a/bin/isolated-functions.sh
37 +++ b/bin/isolated-functions.sh
38 @@ -11,8 +11,6 @@ fi
39 # We need this next line for "die" and "assert". It expands
40 # It _must_ preceed all the calls to die and assert.
41 shopt -s expand_aliases
42 -alias save_IFS='[ "${IFS:-unset}" != "unset" ] && old_IFS="${IFS}"'
43 -alias restore_IFS='if [ "${old_IFS:-unset}" != "unset" ]; then IFS="${old_IFS}"; unset old_IFS; else unset IFS; fi'
44
45 assert() {
46 local x pipestatus=${PIPESTATUS[*]}
47 --
48 2.19.1

Attachments

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

Replies