Skip to content

Comments

kpatch-build: fix Fedora 42+ kernel source directory nesting#1496

Draft
oshoval wants to merge 1 commit intodynup:masterfrom
oshoval:fix-fedora42-kernel-source-nesting
Draft

kpatch-build: fix Fedora 42+ kernel source directory nesting#1496
oshoval wants to merge 1 commit intodynup:masterfrom
oshoval:fix-fedora42-kernel-source-nesting

Conversation

@oshoval
Copy link

@oshoval oshoval commented Feb 24, 2026

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 one level deep and fails on this layout.

Approach

Use 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 one level deeper with find -maxdepth 3, again requiring exactly one result before proceeding.

All mv calls preserve the original 2>&1 | logger || die error handling, and ambiguous matches are always fatal.

Test plan

  • Tested on Fedora 42 with kernel 6.14.0-63.fc42.x86_64
  • shellcheck passes clean
  • Verify on RHEL/CentOS (traditional flat layout still works)

@oshoval oshoval changed the title kpatch-build: fix Fedora 42+ kernel source directory nesting WIP kpatch-build: fix Fedora 42+ kernel source directory nesting Feb 24, 2026
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 one level deep
and fails on this layout.

Use 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 one level deeper with find -maxdepth 3, again
  requiring exactly one result before proceeding.

All mv calls preserve the original "2>&1 | logger || die" error
handling, and ambiguous matches are always fatal.

Tested on Fedora 42 with kernel 6.14.0-63.fc42.x86_64.

Signed-off-by: Or Shoval <oshoval@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@oshoval oshoval force-pushed the fix-fedora42-kernel-source-nesting branch from 5446018 to 5bd7160 Compare February 24, 2026 05:51
@oshoval oshoval changed the title WIP kpatch-build: fix Fedora 42+ kernel source directory nesting kpatch-build: fix Fedora 42+ kernel source directory nesting Feb 24, 2026
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.

1 participant