Gentoo Archives: gentoo-portage-dev

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

Attachments

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