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

zfs-kmod: fix empty rpm requires/conflicts #16121

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

seidelma
Copy link
Contributor

Fix an error in zfs-kmod.spec that causes kmod-zfs packages not to include the correct RPM requires/conflicts relationships.

Motivation and Context

Building zfs 2.2.x (or current master) results in kmod-zfs packages with empty requires/conflicts, as well as the following (non-fatal) error message from rpmbuild:

sh: -c: line 1: unexpected EOF while looking for matching `"'
sh: -c: line 4: syntax error: unexpected end of file

This bug will incorrectly allow kmod-zfs & zfs-dkms packages to coexist on the same machine, potentially causing issues:

$ rpm -qa | grep zfs
<no output>

# Built rpms/created yum repo as below
$ sudo yum -y install zfs kmod-zfs zfs-dkms

$ rpm -qa | grep zfs
libzfs5-2.2.99-448_gf4f156157.el9.aarch64
kmod-zfs-2.2.99-448_gf4f156157.el9.aarch64
zfs-2.2.99-448_gf4f156157.el9.aarch64
zfs-dkms-2.2.99-448_gf4f156157.el9.noarch

With this change applied, RPM correctly no longer allows kmod-zfs & zfs-dkms packages to be installed together:

$ sudo yum -y install zfs kmod-zfs zfs-dkms
Repository 'zfs-local' is missing name in configuration, using id.
zfs-local                                                                                                                                                                     36 MB/s | 112 kB     00:00
Last metadata expiration check: 0:00:01 ago on Mon 22 Apr 2024 05:24:45 PM GMT.
Error:
 Problem: package kmod-zfs-2.2.99-449_g72192945e.el9.aarch64 from zfs-local conflicts with zfs-dkms provided by zfs-dkms-2.2.99-449_g72192945e.el9.noarch from zfs-local
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Description

Fix a script syntax error in the rpm specfile and put the generated output in the preamble file expected by the %kernel_module_package macro elsewhere in the specfile.

How Has This Been Tested?

Tested Environments:
Rocky 9.3 aarch64
Rocky 9.3 x86_64
Centos 7.9 x86_64

Build/install process:

git clone https://github.com/openzfs/zfs.git
# generate the autotools stuff and rpm specfile
pushd zfs
./autogen.sh
./configure
cp rpm/redhat/*spec ~/rpmbuild/SPECS
popd
# put the source in a versioned tarball/directory as rpm expects
ln -s zfs zfs-2.2.99
tar hczf ~/rpmbuild/SOURCES/zfs-2.2.99.tar.gz zfs-2.2.99
# build it
pushd ~/rpmbuild/SPECS
for file in *spec; do rpmbuild -bb "$file"; done
popd
# check for correct rpm relationships
rpm -qp ~/rpmbuild/RPMS/`uname -m`/zfs-kmod*rpm --conflicts
rpm -qp ~/rpmbuild/RPMS/`uname -m`/zfs-kmod*rpm --requires | grep zfs
# create a clean local yum repo for this build
[ -d /tmp/zfs-local-repo ] && rm -rf /tmp/zfs-local-repo
mkdir /tmp/zfs-local-repo
echo -e "[zfs-local]\nbaseurl=file:///tmp/zfs-local-repo\nenabled=1\ngpgcheck=0\nmetadata_expire=1s" | sudo tee /etc/yum.repos.d/zfs-local.repo
for file in `find ~/rpmbuild/RPMS -type f`; do cp "$file" /tmp/zfs-local-repo; done
createrepo /tmp/zfs-local-repo
sudo yum -y install zfs zfs-dkms kmod-zfs

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks for the fix. It looks like this was accidentally introduced in 7062a95.

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Apr 22, 2024
@tonyhutter
Copy link
Contributor

Could you update the commit message to include a brief description, like:

Fix an error in zfs-kmod.spec that causes kmod-zfs packages not to include the
correct RPM requires/conflicts relationships.  With this change applied, RPM
correctly no longer allows kmod-zfs & zfs-dkms packages to be installed together.

@behlendorf behlendorf merged commit 87d81d1 into openzfs:master Apr 23, 2024
21 of 25 checks passed
@behlendorf
Copy link
Contributor

Merged. Above commit messages added when merging.

tonyhutter pushed a commit that referenced this pull request May 2, 2024
Fix an error in zfs-kmod.spec that causes kmod-zfs packages not to
include the correct RPM requires/conflicts relationships.  With this
change applied, RPM correctly no longer allows kmod-zfs & zfs-dkms
packages to be installed together.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Todd Seidelmann <[email protected]>
Closes #16121
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
Fix an error in zfs-kmod.spec that causes kmod-zfs packages not to
include the correct RPM requires/conflicts relationships.  With this
change applied, RPM correctly no longer allows kmod-zfs & zfs-dkms
packages to be installed together.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Todd Seidelmann <[email protected]>
Closes openzfs#16121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants