From 3923eadf3ead4d48a8023e29eb661399af283c2e Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Thu, 11 Jul 2024 11:50:45 +0200 Subject: [PATCH] kdump-lib: Drop 'file' dependency in is_uki Resolves: RHEL-46777 commit 2f21fa2acfac9f6e19e071330f917e60aafc4600 Author: Philipp Rudo Date: Mon Jun 24 17:34:35 2024 +0200 kdump-lib: Drop 'file' dependency in is_uki The 'file' utility is no longer installed per default. In addition there was an update to it so it now reports the file type as application/vnd.microsoft.portable-executable. Thus fall back to use objdump to avoid adding yet an other dependency for kdump-utils and deal with different versions of 'file'. Note: This has the small drawback that objdump is arch specific. I.e. examining a aarch64 UKI on a x86_64 machine will return an 'file format not recognized' error. Signed-off-by: Philipp Rudo Signed-off-by: Philipp Rudo --- kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdump-lib.sh b/kdump-lib.sh index 1890bb7..0ccabc0 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -15,7 +15,7 @@ is_uki() img="$1" [[ -f "$img" ]] || return - [[ "$(file -b --mime-type "$img")" == application/x-dosexec ]] || return + [[ "$(objdump -a "$img" 2> /dev/null)" =~ pei-(x86-64|aarch64-little) ]] || return objdump -h -j .linux "$img" &> /dev/null }