Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base-files: vkpurge: fix parameter expansion in list_kernels() #24298

Closed
wants to merge 1 commit into from
Closed

base-files: vkpurge: fix parameter expansion in list_kernels() #24298

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 15, 2020

This fixes next-kernels from having too much string of their versions
stripped.

Next-kernel versions have the format "vmlinu[xz]--next-".
Thus, the string was wrongly shortened to "", instead of the
correct "-next-".

@ericonr
Copy link
Member

ericonr commented Aug 15, 2020

You need to change the version or revision or the template in order to get it rebuilt.

@ghost
Copy link
Author

ghost commented Aug 15, 2020

Oh, right! Forgot.

This fixes next-kernels from having too much string of their versions
stripped.

Next-kernel versions have the format "vmlinu[xz]-<ver>-next-<date>".
Thus, the string was wrongly shortened to "<date>", instead of the
correct "<ver>-next-<date>".
@ahesford
Copy link
Member

The vkpurge script exists to remove files orphaned by official Void kernel packages. What Void kernel ships with names of the form vmlinu[xz]--next-?

Correct functionality requires that kernel names take the form /boot/vmlinu[xz]-$(uname -r) and that uname -r also have the same form as ${k##*-}. In practice, Void only ships kernels where $(uname -r) does not contain hyphens, so vkpurge works as expected in its current form. If Void were ever to ship kernels with a LOCALVERSION that contained a hyphenated suffix, your change would probably be sufficient to handle those kernels. If Void were to differentiate kernels based on some prefix that does not get incorporated into kernel versioning (for example, vmlinuz-lts-5.7.15_1 for $(uname -r) = 5.7.15_1, the entire vkpurge behavior would need to be rethought.

@q66
Copy link
Contributor

q66 commented Aug 18, 2020

there are no next-kernels in void, so what do you mean?

@ahesford
Copy link
Member

I think this is more consistent even if official Void kernels don't ship with anything more than a single hyphen. Let's say a local package (or unpackaged kernel build) modifies LOCALVERSION to be -test_${revision}. We have two kernels:

/boot/vmlinuz-5.7.14_1
/boot/vmlinuz-5.7.14-test_1

Running vkpurge list before this patch is applied, if you are on 5.7.14_1, will show

test_1

and attempting to vkpurge rm all will look for /boot/vmlinuz-test_1, which is clearly not correct.

After the patch, vkpurge list will show

5.7.14-test_1

and vkpurge rm all will look for and successfully delete /boot/vmlinuz-5.7.14-test_1.

@ghost
Copy link
Author

ghost commented Aug 19, 2020 via email

@ahesford
Copy link
Member

Merging because this should have no change in behavior for current official Void kernels but, if anybody customizes the kernel LOCALVERSION, this should provide more consistent behavior. This almost certainly will not work with your strange "-next-" kernel because I doubt that uname -r returns "-next-". If that "-next-" kernel does not belong to any installed kernel package, this new vkpurge will want to remove the kernel even if it is the currently running kernel.

@ahesford ahesford closed this in 67e7b4b Aug 19, 2020
@ghost
Copy link
Author

ghost commented Aug 19, 2020 via email

@ghost ghost deleted the vkpurge branch August 19, 2020 02:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants