Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 705246 - kernel-2.eclass uses lexicographical version compare
Summary: kernel-2.eclass uses lexicographical version 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:10 UTC by Sergei Trofimovich
Modified: 2020-05-27 19:21 UTC (History)
0 users

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 gentoo-dev 2020-01-12 11:10:12 UTC
kernel-2.eclass uses lexicographical string version compare:

    eclass/kernel-2.eclass:	if [[ ${K_SYMLINK} > 0 ]]; then
    eclass/kernel-2.eclass:			if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then
    eclass/kernel-2.eclass:		if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
    eclass/kernel-2.eclass:	if [[ -n ${KV_MINOR} &&  ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then

The intention is likely to use 'ver_cmp'. See bug #705240 for hints to fix it.
Comment 1 Michael 'veremitz' Everitt 2020-05-22 19:18:09 UTC
+1 ACK for patch posted on -dev ML.

@slyfox, can you attach to this bug, pls?! tia.
Comment 2 Sergei Trofimovich gentoo-dev 2020-05-22 19:45:03 UTC
Sent https://archives.gentoo.org/gentoo-dev/message/e6eef477d11592e00bead2ad5168d7d5 for review.
Comment 3 Mike Pagano gentoo-dev 2020-05-25 23:28:07 UTC
++ and Thanks
Comment 4 Larry the Git Cow gentoo-dev 2020-05-26 22:00:21 UTC
The bug has been closed via the following commit(s):

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

commit 8493b3a1823ea5f24f44ea317ceced513b6722ed
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-22 19:10:43 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-26 22:00:08 +0000

    kernel-2.eclass: avoid lexicographical compare on versions, bug #705246
    
    Originally found in bug #705240 as:
    
    ```
    if [[ ... || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
    ```
    
    '>' are string comparisons. They are benign so far, but
    will start failing on linux-10 :)
    
    Let's be consistent and use version comparison.
    
    Closes: https://bugs.gentoo.org/705246
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/kernel-2.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Comment 5 Sergei Trofimovich gentoo-dev 2020-05-26 22:04:09 UTC
Messed up syntax in one of conditionals. Reverted as https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5abea00d6d178139414ccc845a77d4c3e0e1f29

Well resend once fix up.
Comment 6 Larry the Git Cow gentoo-dev 2020-05-27 19:21:02 UTC
The bug has been closed via the following commit(s):

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

commit c54b9d619157d9a24e72f04d5698a00ee9a368dd
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-22 19:10:43 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-27 19:20:57 +0000

    kernel-2.eclass: avoid lexicographical compare on versions, bug #705246
    
    Originally found in bug #705240 as:
    
    ```
    if [[ ... || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
    ```
    
    '>' are string comparisons. They are benign so far, but
    will start failing on linux-10 :)
    
    Let's be consistent and use version comparison.
    
    Closes: https://bugs.gentoo.org/705246
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/kernel-2.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)