Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 705248 - linux-info.eclass uses lexicographical compare
Summary: linux-info.eclass uses lexicographical compare
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 705240
  Show dependency tree
 
Reported: 2020-01-12 11:13 UTC by Sergei Trofimovich (RETIRED)
Modified: 2020-05-23 22:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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(-)