From 57370286678a368fff7ff53a6a99238e9165fc2c Mon Sep 17 00:00:00 2001 From: Evgenii Shatokhin Date: Tue, 17 Nov 2015 16:25:28 +0300 Subject: [PATCH] kpatch-build: fix gcc_version_check: both "GNU" and "GCC" are possible This fix is an addition to 9fedd0d283 "kpatch-build: fix gcc_version_check". On some systems, the GCC version stored in vmlinux may have the following format: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-9) while GCC returns (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9) As a result, binary patches cannot be built, although the compiler is the same. gcc_version_check() now takes this into account. Signed-off-by: Evgenii Shatokhin --- kpatch-build/kpatch-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index d487be7..da8bc96 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -119,8 +119,8 @@ find_dirs() { gcc_version_check() { # ensure gcc version matches that used to build the kernel - local gccver=$(gcc --version |head -n1 |cut -d' ' -f2-) - local kgccver=$(readelf -p .comment $VMLINUX |grep GCC: | tr -s ' ' | cut -d ' ' -f5-) + local gccver=$(gcc --version | head -n1 | cut -d' ' -f2- | sed 's/GNU/GCC/g') + local kgccver=$(readelf -p .comment $VMLINUX | grep GCC: | tr -s ' ' | cut -d ' ' -f5- | sed 's/GNU/GCC/g') if [[ "$gccver" != "$kgccver" ]]; then warn "gcc/kernel version mismatch" echo "gcc version: $gccver"