From 9a84b5ba8ef3a38128ca3539dfb76a87590affb3 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Wed, 17 Nov 2021 12:05:49 +0100 Subject: [PATCH] brp-kmod-restore-perms: handle kmod compression done in post-install hooks If a kernel module are compressed by a post-install hook, then its name would differ from the one saved by brp-kmod-set-exec-bit; try to recover from this by guessing a possible name of the compressed kmod and using it instead. * brp-kmod-restore-perms (while read perm path): Check for "$RPM_BUILD_ROOT/$path.gz", "$RPM_BUILD_ROOT/$path.bz2", and "$RPM_BUILD_ROOT/$path.xz" if "$RPM_BUILD_ROOT/$path" does not exist, add the respective suffix to the $path. Resolves: #1942537 Signed-off-by: Eugene Syromiatnikov --- brp-kmod-restore-perms | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/brp-kmod-restore-perms b/brp-kmod-restore-perms index 6fc62f4..3822fa4 100755 --- a/brp-kmod-restore-perms +++ b/brp-kmod-restore-perms @@ -14,6 +14,13 @@ which chmod >/dev/null || exit 0 while read perm path; do [ -n "$perm" ] || continue + # Account for possible kernel module compression + [ -e "$RPM_BUILD_ROOT/$path" ] || { + [ \! -e "$RPM_BUILD_ROOT/$path.gz" ] || path="$path.gz" + [ \! -e "$RPM_BUILD_ROOT/$path.bz2" ] || path="$path.bz2" + [ \! -e "$RPM_BUILD_ROOT/$path.xz" ] || path="$path.xz" + } + chmod "$perm" "$RPM_BUILD_ROOT/$path" done < "$RPM_BUILD_ROOT/kmod-permissions.list"