Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 705248

Summary: linux-info.eclass uses lexicographical compare
Product: Gentoo Linux Reporter: Sergei Trofimovich (RETIRED) <slyfox>
Component: EclassesAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 705240    

Description Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-12 11:13:02 UTC
linux-info.eclass uses lexicographical string version compare:

eclass/linux-info.eclass:		if [[ ${error} > 0 ]]; then
eclass/linux-info.eclass:	if [[ ${hard_errors_count} > 0 ]]; then
eclass/linux-info.eclass:	elif [[ ${soft_errors_count} > 0 ]]; then

The intention is likely to use '-gt'. See bug #705240 for hints to fix it.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-22 19:02:02 UTC
Sent https://archives.gentoo.org/gentoo-dev/message/92175f6ac74d8d2fc775282f3076a634 for review. The change looks trivial.
Comment 2 Michael 'veremitz' Everitt 2020-05-22 19:04:17 UTC
+1 ACK from the [kernel] peanut gallery.
Comment 3 Larry the Git Cow gentoo-dev 2020-05-23 22:59:10 UTC
The bug has been closed via the following commit(s):

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

commit aa1d259decdfd73a49e0c49e88a8ec5675453266
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-22 18:53:44 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-23 22:59:04 +0000

    linux-info.eclass: avoid lexicographical compare on numbers, bug #705248
    
    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.
    
    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(-)