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

Use samefile() instead of regex matching when checking bootloader kernel paths #43

Closed
wants to merge 2 commits into from

Conversation

bstaletic
Copy link
Contributor

This allows eclean-kernel to correctly identify the kernels used by the bootloader config in the following scenario:

  1. LILO says image=/boot/vmlinuz
  2. /boot/vmlinuz is a symlink to /boot/vmlinuz-X.Y.Z-suffix, which is the actual kernel.

Before this commit, eclean-kernel -ap woulc complain that

Note: strangely named used kernel: /boot/vmlinuz

and then list vmlinuz-X.Y.Z-suffix as one of the kernels to be removed.

Closes #42

Comment on lines 104 to 108
def get_kernel_images(kernel_files: typing.List[GenericFile]
) -> typing.Iterable[KernelImage]:
return (kernel_file.path
for kernel_file in kernel_files
if type(kernel_file) is KernelImage)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to do this, you can just match against all files.

Now if you wanted to optimize this, you could collect (st_dev, st_ino) tuples for files and match against that but I don't think it's technically necessary here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. I just thought it would be silly (though not strictly wrong) to match against all files. In lilo.conf (and I believe grub.cfg) I do only expect to find a reference to a KernelImage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know but I think it's better to keep the code simple.

…nel paths

This allows eclean-kernel to correctly identify the kernels used by the
bootloader config in the following scenario:

1. LILO says `image=/boot/vmlinuz`
2. `/boot/vmlinuz` is a symlink to `/boot/vmlinuz-X.Y.Z-suffix`, which
   is the actual kernel.

Before this commit, eclean-kernel -ap woulc complain that

    Note: strangely named used kernel: /boot/vmlinuz

and then list `vmlinuz-X.Y.Z-suffix` as one of the kernels to be
removed.
ecleankernel/process.py Outdated Show resolved Hide resolved
ecleankernel/process.py Outdated Show resolved Hide resolved
test/test_process.py Outdated Show resolved Hide resolved
@mgorny
Copy link
Member

mgorny commented Aug 20, 2023

Do you want to fix the QA issues reported by CI or should I do it while merging?

@bstaletic
Copy link
Contributor Author

Do you want to fix the QA issues reported by CI or should I do it while merging?

Sorry about that! Should all be fixed now.

Copy link
Member

@mgorny mgorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mgorny
Copy link
Member

mgorny commented Aug 21, 2023

I'll release 2.99.6 shortly.

@mgorny mgorny closed this Aug 21, 2023
@bstaletic
Copy link
Contributor Author

Thanks! You do not need to make me the reason for a hasty release. I can use =eclean-kernel-9999 for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Current implementation of bootloader processing does not work well with symlinks
2 participants