Gentoo Archives: gentoo-portage-dev

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

Attachments

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

Replies