-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix %post and %postun generation in kmodtool #8866
Conversation
During zfs-kmod RPM build, $(uname -r) gets unintentionally evaluated on the build host, once and for all. It should be evaluated during the execution of the scriptlets on the installation host. Escaping the $ character avoids evaluating it during build. Signed-off-by: Samuel Verschelde <stormi-xcp@ylix.fr>
Escape $(uname -r) because we don't want it to run on the build host. It needs to run when the scriptlet itself is executed. Also contributed upstream: openzfs/zfs#8866
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good, I also verified that this same fix was applied to the upstream kmodtool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Codecov Report
@@ Coverage Diff @@
## master #8866 +/- ##
==========================================
+ Coverage 78.65% 78.73% +0.08%
==========================================
Files 382 382
Lines 117778 117778
==========================================
+ Hits 92638 92735 +97
+ Misses 25140 25043 -97
Continue to review full report at Codecov.
|
During zfs-kmod RPM build, $(uname -r) gets unintentionally evaluated on the build host, once and for all. It should be evaluated during the execution of the scriptlets on the installation host. Escaping the $ character avoids evaluating it during build. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Olaf Faaland <faaland1@llnl.gov> Reviewed-by: Neal Gompa <ngompa@datto.com> Signed-off-by: Samuel Verschelde <stormi-xcp@ylix.fr> Closes #8866
During zfs-kmod RPM build, $(uname -r) gets unintentionally evaluated on
the build host, once and for all. It should be evaluated during the
execution of the scriptlets on the installation host. Escaping the $
character avoids evaluating it during build.
Signed-off-by: Samuel Verschelde stormi-xcp@ylix.fr
Motivation and Context
I'm maintaining the zfs packages for XCP-ng, a free virtualization solution forked from XenServer (https://xcp-ng.org/). I noticed that
depmod -a
was not executed after the module RPM was installed and this led me to discovering this bug inkmodtool
as shipped by the project with the source RPMs.The
%post
and%postun
scriptlets generated by kmodtool are broken: either the build host has the same running kernel as the target kernel and thendepmod -a
will be executed each time a zfs-kmod-xxx package is installed, or the version is different (as in my example below) anddepmod -a
is never executed because the test always evaluates to false.Description
Escape
$(uname -r)
so that it's not evaluated on the build host.How Has This Been Tested?
RPM built in a docker container then checked with
rpm -qp nameoffile --scripts
and installed on an XCP-ng host (centos based with custom kernel).modprobe zfs
worked without the need to rundepmod -a
manually whereas it didn't before the fix on similar hosts.Output of
rpm -qp nameoffile --scripts
before the change:Output after the fix:
Types of changes
Checklist:
Signed-off-by
.