kpatch-build: fix Fedora 42+ kernel source directory nesting#1496
Open
oshoval wants to merge 2 commits intodynup:masterfrom
Open
kpatch-build: fix Fedora 42+ kernel source directory nesting#1496oshoval wants to merge 2 commits intodynup:masterfrom
oshoval wants to merge 2 commits intodynup:masterfrom
Conversation
5446018 to
5bd7160
Compare
c59f132 to
ac2e396
Compare
Starting with Fedora 42, the kernel SRPM unpacks with an extra level of nesting: BUILD/kernel-6.14.0-build/kernel-6.14/linux-6.14.0-63.fc42.x86_64/ The existing glob BUILD/kernel-*/linux-* only matches the traditional flat layout and fails on this structure. Extract the source-finding logic into find_rpm_linux_srcdir() in a new kpatch-funcs.sh, using nullglob with a bash array to safely count flat-glob matches: - Exactly one match: move it (traditional RHEL/CentOS/Fedora < 42). - Multiple matches: die with a clear diagnostic. - Zero matches: search deeper with find -maxdepth 3, excluding configs/ directories, again requiring exactly one result. Signed-off-by: Or Shoval <oshoval@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Simulate RPM BUILD directory layouts across distros to validate the source extraction logic introduced in the previous commit: - Flat layout (Fedora < 42, RHEL 9, aarch64 variant) - Nested layout (Fedora 42+, aarch64 variant) - configs/ directory exclusion - Error cases: ambiguous matches, missing source, excessive depth Signed-off-by: Or Shoval <oshoval@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
ac2e396 to
02784af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1497
Starting with Fedora 42, the kernel SRPM unpacks with an extra level of nesting:
The existing glob
BUILD/kernel-*/linux-*only matches the traditional flat layout and misses it.Fix
Extract source-finding into
find_rpm_linux_srcdir()in a newkpatch-funcs.sh, sourced bykpatch-build:diewith diagnosticfind -maxdepth 3excludingconfigs/dirs, requiring exactly one result (nested layout — Fedora 42+)Tests
Unit tests in
test/unit/test-fedora-source-nesting.shsource the function directly and simulate flat, nested, multi-match, empty, and too-deep layouts with real distro version patterns. Run standalone:Not wired into the existing
test/unit/Makefile(which is object-file based) — happy to integrate if preferred.Tested
shellcheckcleankpatch-buildon Fedora 42 without--sourcedir(our test environment used--sourcedirwhich bypasses SRPM extraction — happy to run a stock-kernel e2e once there's a conceptual LGTM)mvextracted as-is; unit tests verify against real RHEL 9 and Fedora 41 directory names (will e2e if required)