Gentoo Archives: gentoo-dev

From: Mike <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248
Date: Sat, 23 May 2020 18:56:13
Message-Id: 04cf909b-e030-a10d-1c8b-91bc08f4af54@gentoo.org
In Reply to: [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248 by Sergei Trofimovich
1 On 5/22/20 2:57 PM, Sergei Trofimovich wrote:
2 > Originally found in bug #705240 as:
3 >
4 > ```
5 > error=0
6 > ...
7 > if [[ ${error} > 0 ]]; then
8 > ...
9 > ```
10 >
11 > '>' are string comparisons. They are benign in this case, but let's
12 > be consistent and use integer comparison.
13 >
14 > CC: kernel@g.o
15 > Closes: https://bugs.gentoo.org/705248
16 > Signed-off-by: Sergei Trofimovich <slyfox@g.o>
17 > ---
18 > eclass/linux-info.eclass | 6 +++---
19 > 1 file changed, 3 insertions(+), 3 deletions(-)
20 >
21 > diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
22 > index 44eebcf52a9..405ef5571e1 100644
23 > --- a/eclass/linux-info.eclass
24 > +++ b/eclass/linux-info.eclass
25 > @@ -813,7 +813,7 @@ check_extra_config() {
26 > linux_chkconfig_present ${config} || error=1
27 > fi
28 >
29 > - if [[ ${error} > 0 ]]; then
30 > + if [[ ${error} -gt 0 ]]; then
31 > local report_func="eerror" local_error
32 > local_error="ERROR_${config}"
33 > local_error="${!local_error}"
34 > @@ -848,14 +848,14 @@ check_extra_config() {
35 > fi
36 > done
37 >
38 > - if [[ ${hard_errors_count} > 0 ]]; then
39 > + if [[ ${hard_errors_count} -gt 0 ]]; then
40 > eerror "Please check to make sure these options are set correctly."
41 > eerror "Failure to do so may cause unexpected problems."
42 > eerror "Once you have satisfied these options, please try merging"
43 > eerror "this package again."
44 > export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
45 > die "Incorrect kernel configuration options"
46 > - elif [[ ${soft_errors_count} > 0 ]]; then
47 > + elif [[ ${soft_errors_count} -gt 0 ]]; then
48 > ewarn "Please check to make sure these options are set correctly."
49 > ewarn "Failure to do so may cause unexpected problems."
50 > else
51 >
52
53 Thanks. LGTM

Attachments

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

Replies