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] einstalldocs: Fix test for DOCS being unset.
Date: Thu, 20 Feb 2020 18:16:03
Message-Id: d2e29dad-e2c2-cb54-e421-7a84cc92ff63@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] einstalldocs: Fix test for DOCS being unset. by "Ulrich Müller"
1 On 2/20/20 5:04 AM, Ulrich Müller wrote:
2 > The current test does not exactly test for unset DOCS, because it also
3 > evaluates as true if the variable has attributes. Such attributes can
4 > be defined even for an unset variable.
5 >
6 > Therefore test the output of declare -p for presence of an = sign
7 > instead, which indicates that a value has been assigned to the
8 > variable (bug 710076 comment #2).
9 >
10 > PMS reference: Algorithm 12.4, line 7:
11 > https://projects.gentoo.org/pms/7/pms.html#x1-135011r183
12 >
13 > See also bash upstream discussion:
14 > https://lists.gnu.org/archive/html/bug-bash/2020-02/msg00045.html
15 >
16 > Closes: https://bugs.gentoo.org/710076
17 > Signed-off-by: Ulrich Müller <ulm@g.o>
18 > ---
19 > bin/phase-helpers.sh | 4 ++--
20 > 1 file changed, 2 insertions(+), 2 deletions(-)
21 >
22 > diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
23 > index 3deb28c68..9495465f9 100644
24 > --- a/bin/phase-helpers.sh
25 > +++ b/bin/phase-helpers.sh
26 > @@ -1,5 +1,5 @@
27 > #!/bin/bash
28 > -# Copyright 1999-2019 Gentoo Authors
29 > +# Copyright 1999-2020 Gentoo Authors
30 > # Distributed under the terms of the GNU General Public License v2
31 >
32 > if ___eapi_has_DESTTREE_INSDESTTREE; then
33 > @@ -953,7 +953,7 @@ fi
34 > if ___eapi_has_einstalldocs; then
35 > einstalldocs() {
36 > (
37 > - if ! declare -p DOCS &>/dev/null ; then
38 > + if [[ $(declare -p DOCS 2>/dev/null) != *=* ]]; then
39 > local d
40 > for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
41 > THANKS BUGS FAQ CREDITS CHANGELOG ; do
42 >
43
44 Looks good. Even though earlier EAPIs are deprecated, would there be a
45 problem with updating __eapi4_src_install for consistency?
46 --
47 Thanks,
48 Zac

Attachments

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

Replies