Gentoo Archives: gentoo-dev

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

Replies