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

find_module:fix a mistake for kernel with modules uncompressed #442

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

WizardHowlhaha
Copy link
Contributor

@WizardHowlhaha WizardHowlhaha commented Sep 12, 2024

For kernel with modules uncompressed,dkms find_module()'s command: find "$1" -name "$2$module_uncompressed_suffix" -o -name "$2$module_suffix" -type f actually turns out to be:
find /lib/modules/[kerv] -name [module_name].ko -o -name [module_name].ko -type -f

the "type -f" is used to include only for regular file, but with the command above, it only takes effect for the lastest "-name" match,and will get the symbolic files (are usually the symbolic files for weak_modules in /lib/*/weak-updates directory) by mistake.

For kernel with modules compressed the command turns out to be like: find /lib/modules/[kerv] -name [module_name].ko -o -name [module_name].ko.xz -type -f All the modules are with suffix ".xz",the first "-name" match actually do nothing so it's get nothing wrong.

Fix it by adding "-type -f" param after each "-name" option.

@scaronni
Copy link
Collaborator

I guess you didn't test this merge request at all, right?

find: invalid argument '-f' to '-type'

You have an extra "-" in the first find option.

@scaronni
Copy link
Collaborator

It doesn't hurt to add -type f to both cases so it's not only matched for the second one, but this would fail and not return the proper result only if the first match is a folder and not a file with modulaname.ko as the name, which is very unlikely.

Anyway, please fix the command and we can merge. Thanks.

@scaronni scaronni self-assigned this Sep 12, 2024
dkms.in Outdated
@@ -228,7 +228,7 @@ find_module()
{
# tree = $1
# module = $2
find "$1" -name "$2$module_uncompressed_suffix" -o -name "$2$module_suffix" -type f
find "$1" -name "$2$module_uncompressed_suffix" -type -f -o -name "$2$module_suffix" -type f
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the first dash as -type f.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.I also corrected the commit information.

@WizardHowlhaha
Copy link
Contributor Author

I guess you didn't test this merge request at all, right?

find: invalid argument '-f' to '-type'

You have an extra "-" in the first find option.

My mistake,I was too careless. Thanks for pointing it out,I've already made the changes.

@WizardHowlhaha
Copy link
Contributor Author

It doesn't hurt to add -type f to both cases so it's not only matched for the second one, but this would fail and not return the proper result only if the first match is a folder and not a file with modulaname.ko as the name, which is very unlikely.

Anyway, please fix the command and we can merge. Thanks.

Thanks for your help, I've already fix the command.

For kernel with modules uncompressed,dkms find_module()'s command:
find "$1" -name "$2$module_uncompressed_suffix" -o -name "$2$module_suffix" -type f
actually turns out to be:
`find /lib/modules/[kerv] -name [module_name].ko -o -name [module_name].ko -type f`

the "-type f" is used to include only for regular file, but with the command above,
it only takes effect for the lastest "-name" match,and will get the symbolic files
(are usually the symbolic files for weak_modules in /lib/*/weak-updates directory)
by mistake.

For kernel with modules compressed the command turns out to be like:
`find /lib/modules/[kerv] -name [module_name].ko -o -name [module_name].ko.xz -type f`
All the modules are with suffix ".xz",the first "-name" match actually do nothing so it's
get nothing wrong.

Fix it by adding "-type f" param after each "-name" option.
@scaronni scaronni merged commit 270e0cd into dell:master Sep 15, 2024
27 of 28 checks passed
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.

2 participants