Gentoo Archives: gentoo-dev

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