bugGNU GRUB - Bugs: bug #42597, Alpha sorting for kernel names...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #42597: Alpha sorting for kernel names without versions (rolling release)

Submitted by:  Troy Engel <troyengel>
Submitted on:  Sun 22 Jun 2014 05:32:44 PM UTC  
 
Category:  User Interface Severity:  Major
Priority:  5 - Normal Item Group:  Feature Request
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release: 
Release:  2.02~beta1 Reproducibility:  Every Time
Planned Release:  2.03+

Wed 31 Jan 2018 02:15:41 AM UTC, comment #1:

wrong sort in version_test_numeric().

I installed different kernels under arch linux. A grub-mkconfig ordered the menu entries oddly.
As arch is not using versioning numbers in the kernel image's filenames, it should sort alphabetically.

Example
/boot/vmlinuz-linux-lts
/boot/vmlinuz-hardened
/boot/vmlinuz-zen

the lts entry somehow always was sorted out as "newest". But it should be following order hardened, lts, zen.

I found a typo in grub-mkconfig_lib.in line 233:
if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then

It should be
....... | grep -qx "$version_test_numeric_a" ; then

After that fix the ordering is correct in my case.

(file #43128)

Sir Grublon <grublon>
Sun 22 Jun 2014 05:32:44 PM UTC, original submission:

The /etc/grub.d/10_linux design is based around the expectation that kernel names in /boot will contain version numbers, allowing the newest version to sort to the top and become the default entry. For systems like Fedora/Red Hat/CentOS this works fine.

For rolling release distros like Arch, this causes the last entry in the found list to become the default. For example, if you install the "linux" and "linux-lts" kernels the natural find order in 10_linux is "linux linux-lts".

The callout to version_find_latest results in returning "linux-lts" due to how the code works in grub-mkconfig_lib and specifically version_sort_numeric here:

Attached is my attempt at a basic patch that checks the string of kernels found and if there are no numerics present in them, default to popping them off the stack in order found (natural alpha sort from the "for i in..." code previously).

There is probably a better way to do this, but this simple hack works for the basic Arch install to allow "linux" to be the expected default, leaving "linux-lts" to be available for emergency purposes.

Troy Engel <troyengel>

 

Attached Files
file #43128:  grub.patch added by grublon (576B - text/x-patch - typo fix in version_test_numeric() - fix alphabetical sorting problem)
file #31596:  10_linux_noversion.patch added by troyengel (728B - text/x-patch - Patch to check for versions in kernel name first)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tyilo
  • -email is unavailable- added by grublon (Updated the item)
  • -email is unavailable- added by phcoder (Updated the item)
  • -email is unavailable- added by troyengel (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Sun 25 Feb 2018 11:12:06 PM UTC tyilo Carbon-Copy- => Added -email is unavailable-
    Wed 31 Jan 2018 02:15:41 AM UTC grublon Attached File- => Added grub.patch, #43128
    Wed 02 Mar 2016 12:42:49 PM UTC phcoder Planned ReleaseNone => 2.03+
    Sun 22 Jun 2014 05:32:44 PM UTC troyengel Attached File- => Added 10_linux_noversion.patch, #31596

    Back to the top


    Powered by Savane 3.3