Skip to content

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

Merged
scaronni merged 1 commit intodkms-project:masterfrom
WizardHowlhaha:master
Sep 15, 2024
Merged

find_module:fix a mistake for kernel with modules uncompressed#442
scaronni merged 1 commit intodkms-project:masterfrom
WizardHowlhaha:master

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
Member

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
Member

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
# 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
Member

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.

@WizardHowlhaha WizardHowlhaha force-pushed the master branch 3 times, most recently from fd7b339 to 1cfca90 Compare September 14, 2024 08:48
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 dkms-project:master Sep 15, 2024
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