Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909538 - dist-kernel-utils.eclass appends files in /etc/kernel/install.d instead of running them instead
Summary: dist-kernel-utils.eclass appends files in /etc/kernel/install.d instead of ru...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal major
Assignee: Distribution Kernel Project
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2023-07-02 21:14 UTC by Chris Pritchard
Modified: 2023-07-05 06:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
fix-etc-install-scripts.patch (file_909538.txt,1.40 KB, patch)
2023-07-02 21:20 UTC, Chris Pritchard
Details | Diff
fix-etc-install-scripts.patch (file_909538.txt,1.30 KB, patch)
2023-07-02 21:25 UTC, Chris Pritchard
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Pritchard 2023-07-02 21:14:29 UTC
according to the systemd-installkernel manpage, files in /etc/kernel/install.d should override files in /usr/lib/kernel/install.d/ if they have the same name. This makes sense, because otherwise there is no way of preventing a file in /usr/lib/kernel/install.d from running, or from replacing existing functionality.

The dist-kernel-utils.eclass function "dist-kernel_install_kernel()" appends the files to KERNEL_INSTALL_PLUGINS when addressing a bug that makes dracut run twice.

Reproducible: Always

Steps to Reproduce:
1. Have a file with the same name as a file in /usr/lib/kernel/install.d/ in /etc/kernel/install.d/
2. run emerge --config gentoo-kernel (or another distribution kernel) with installkernel-systemd-boot installed
Actual Results:  
both the file in /usr/lib/kernel/install.d/ and the file in /etc/kernel/install.d/ are executed

Expected Results:  
Only the file in /etc/kernel/install.d is executed
Comment 1 Chris Pritchard 2023-07-02 21:20:20 UTC
Created attachment 865052 [details, diff]
fix-etc-install-scripts.patch
Comment 2 Chris Pritchard 2023-07-02 21:25:24 UTC
Created attachment 865053 [details, diff]
fix-etc-install-scripts.patch

missed off a "local" in the original patch
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-07-03 03:50:32 UTC
Thanks for the patch.

Andrew, can you confirm?
Comment 4 Nowa Ammerlaan gentoo-dev 2023-07-03 08:06:19 UTC
(In reply to Michał Górny from comment #3)
> Thanks for the patch.
> 
> Andrew, can you confirm?

Yes this does appear to be the intended behaviour, from the manual:

kernel-install will run the executable files ("plugins") located in the directory
/usr/lib/kernel/install.d/ and the local administration directory /etc/kernel/install.d/. All files
are collectively sorted and executed in lexical order, regardless of the directory in which they
live. However, files with identical filenames replace each other. Files in /etc/kernel/install.d/
take precedence over files with the same name in /usr/lib/kernel/install.d/. This can be used to
override a system-supplied executables with a local file if needed; a symbolic link in
/etc/kernel/install.d/ with the same name as an executable in /usr/lib/kernel/install.d/, pointing
to /dev/null, disables the executable entirely. Executables must have the extension ".install";
other extensions are ignored.
Comment 5 Nowa Ammerlaan gentoo-dev 2023-07-03 08:13:28 UTC
Btw, my upstream PR with the proper fix has been merged, so hopefully we can get rid of this workaround soon.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-07-03 11:10:09 UTC
Chris, could you either reattach the patch in git format with a proper signed-off-by line, or at least paste the signed-off-by line in a comment to confirm that the commit agrees with the DCO?
Comment 7 Chris Pritchard 2023-07-03 11:24:01 UTC
Will do, but it will likely be tomorrow now as I'm busy for the rest of the day!
Comment 8 Larry the Git Cow gentoo-dev 2023-07-05 06:19:13 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f54de2508fd57a8f31b5dc61b970448ab22c20d

commit 7f54de2508fd57a8f31b5dc61b970448ab22c20d
Author:     Chris Pritchard <chris@christopherpritchard.co.uk>
AuthorDate: 2023-07-04 23:01:24 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2023-07-05 06:19:04 +0000

    dist-kernel-utils.eclass: fix user script overrides
    
    Closes: https://bugs.gentoo.org/909538
    Signed-off-by: Chris Pritchard <chris@christopherpritchard.co.uk>
    Closes: https://github.com/gentoo/gentoo/pull/31745
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/dist-kernel-utils.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)