public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248
@ 2020-05-22 18:57 Sergei Trofimovich
  2020-05-23 18:56 ` Mike
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 18:57 UTC (permalink / raw
  To: gentoo-dev; +Cc: Sergei Trofimovich, kernel

Originally found in bug #705240 as:

```
  error=0
  ...
  if [[ ${error} > 0 ]]; then
  ...
```

'>' are string comparisons. They are benign in this case, but let's
be consistent and use integer comparison.

CC: kernel@gentoo.org
Closes: https://bugs.gentoo.org/705248
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 eclass/linux-info.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 44eebcf52a9..405ef5571e1 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -813,7 +813,7 @@ check_extra_config() {
 			linux_chkconfig_present ${config} || error=1
 		fi
 
-		if [[ ${error} > 0 ]]; then
+		if [[ ${error} -gt 0 ]]; then
 			local report_func="eerror" local_error
 			local_error="ERROR_${config}"
 			local_error="${!local_error}"
@@ -848,14 +848,14 @@ check_extra_config() {
 		fi
 	done
 
-	if [[ ${hard_errors_count} > 0 ]]; then
+	if [[ ${hard_errors_count} -gt 0 ]]; then
 		eerror "Please check to make sure these options are set correctly."
 		eerror "Failure to do so may cause unexpected problems."
 		eerror "Once you have satisfied these options, please try merging"
 		eerror "this package again."
 		export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
 		die "Incorrect kernel configuration options"
-	elif [[ ${soft_errors_count} > 0 ]]; then
+	elif [[ ${soft_errors_count} -gt 0 ]]; then
 		ewarn "Please check to make sure these options are set correctly."
 		ewarn "Failure to do so may cause unexpected problems."
 	else
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248
  2020-05-22 18:57 [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248 Sergei Trofimovich
@ 2020-05-23 18:56 ` Mike
  2020-05-23 23:01   ` Sergei Trofimovich
  0 siblings, 1 reply; 3+ messages in thread
From: Mike @ 2020-05-23 18:56 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1797 bytes --]



On 5/22/20 2:57 PM, Sergei Trofimovich wrote:
> Originally found in bug #705240 as:
> 
> ```
>   error=0
>   ...
>   if [[ ${error} > 0 ]]; then
>   ...
> ```
> 
> '>' are string comparisons. They are benign in this case, but let's
> be consistent and use integer comparison.
> 
> CC: kernel@gentoo.org
> Closes: https://bugs.gentoo.org/705248
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
>  eclass/linux-info.eclass | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
> index 44eebcf52a9..405ef5571e1 100644
> --- a/eclass/linux-info.eclass
> +++ b/eclass/linux-info.eclass
> @@ -813,7 +813,7 @@ check_extra_config() {
>  			linux_chkconfig_present ${config} || error=1
>  		fi
>  
> -		if [[ ${error} > 0 ]]; then
> +		if [[ ${error} -gt 0 ]]; then
>  			local report_func="eerror" local_error
>  			local_error="ERROR_${config}"
>  			local_error="${!local_error}"
> @@ -848,14 +848,14 @@ check_extra_config() {
>  		fi
>  	done
>  
> -	if [[ ${hard_errors_count} > 0 ]]; then
> +	if [[ ${hard_errors_count} -gt 0 ]]; then
>  		eerror "Please check to make sure these options are set correctly."
>  		eerror "Failure to do so may cause unexpected problems."
>  		eerror "Once you have satisfied these options, please try merging"
>  		eerror "this package again."
>  		export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
>  		die "Incorrect kernel configuration options"
> -	elif [[ ${soft_errors_count} > 0 ]]; then
> +	elif [[ ${soft_errors_count} -gt 0 ]]; then
>  		ewarn "Please check to make sure these options are set correctly."
>  		ewarn "Failure to do so may cause unexpected problems."
>  	else
> 

Thanks. LGTM


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248
  2020-05-23 18:56 ` Mike
@ 2020-05-23 23:01   ` Sergei Trofimovich
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Trofimovich @ 2020-05-23 23:01 UTC (permalink / raw
  To: gentoo-dev

On Sat, 23 May 2020 14:56:06 -0400
Mike <mpagano@gentoo.org> wrote:

> On 5/22/20 2:57 PM, Sergei Trofimovich wrote:
> > Originally found in bug #705240 as:
> > 
> > ```
> >   error=0
> >   ...
> >   if [[ ${error} > 0 ]]; then
> >   ...
> > ```
> >   
> > '>' are string comparisons. They are benign in this case, but let's  
> > be consistent and use integer comparison.
> > 
> > CC: kernel@gentoo.org
> > Closes: https://bugs.gentoo.org/705248
> > Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> > ---
> >  eclass/linux-info.eclass | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
> > index 44eebcf52a9..405ef5571e1 100644
> > --- a/eclass/linux-info.eclass
> > +++ b/eclass/linux-info.eclass
> > @@ -813,7 +813,7 @@ check_extra_config() {
> >  			linux_chkconfig_present ${config} || error=1
> >  		fi
> >  
> > -		if [[ ${error} > 0 ]]; then
> > +		if [[ ${error} -gt 0 ]]; then
> >  			local report_func="eerror" local_error
> >  			local_error="ERROR_${config}"
> >  			local_error="${!local_error}"
> > @@ -848,14 +848,14 @@ check_extra_config() {
> >  		fi
> >  	done
> >  
> > -	if [[ ${hard_errors_count} > 0 ]]; then
> > +	if [[ ${hard_errors_count} -gt 0 ]]; then
> >  		eerror "Please check to make sure these options are set correctly."
> >  		eerror "Failure to do so may cause unexpected problems."
> >  		eerror "Once you have satisfied these options, please try merging"
> >  		eerror "this package again."
> >  		export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
> >  		die "Incorrect kernel configuration options"
> > -	elif [[ ${soft_errors_count} > 0 ]]; then
> > +	elif [[ ${soft_errors_count} -gt 0 ]]; then
> >  		ewarn "Please check to make sure these options are set correctly."
> >  		ewarn "Failure to do so may cause unexpected problems."
> >  	else
> >   
> 
> Thanks. LGTM

Pushed as:
  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa1d259decdfd73a49e0c49e88a8ec5675453266

-- 

  Sergei


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-23 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-22 18:57 [gentoo-dev] [PATCH] linux-info.eclass: avoid lexicographical compare on numbers, bug #705248 Sergei Trofimovich
2020-05-23 18:56 ` Mike
2020-05-23 23:01   ` Sergei Trofimovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox