From 6189736a1161de4e1f9a418471ff104a889eb04f Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Jun 15 2023 02:36:54 +0000 Subject: kdumpctl: Fix the matching of plus symbol by grep's EREs Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2160676 Upstream: Fedora rawhide Conflict: None commit 64d93c886f4cd1bc3008e8eb9dea7cdb8e8cc601 Author: Pingfan Liu Date: Fri Jun 9 16:04:29 2023 +0800 kdumpctl: Fix the matching of plus symbol by grep's EREs After introducing 64k variant kernel on aarch64, an example kernel name looks like "vmlinuz-5.14.0-316.el9.aarch64+64k". To match the plus symbol, it demands an escape charater. Signed-off-by: Pingfan Liu Reviewed-by: Philipp Rudo Reviewed-by: Coiby Xu Signed-off-by: Pingfan Liu --- diff --git a/kdumpctl b/kdumpctl index a0f8861..a46f9f9 100755 --- a/kdumpctl +++ b/kdumpctl @@ -1470,7 +1470,10 @@ _filter_grubby_kernel_str() _find_kernel_path_by_release() { local _release="$1" _grubby_kernel_str _kernel_path - _grubby_kernel_str=$(grubby --info ALL | grep "^kernel=.*$_release\"$") + + # Insert '/' before '+' to cope with grep's EREs + _release=${_release//+/\\+} + _grubby_kernel_str=$(grubby --info ALL | grep -E "^kernel=.*$_release(\/\w+)?\"$") _kernel_path=$(_filter_grubby_kernel_str "$_grubby_kernel_str") if [[ -z $_kernel_path ]]; then ddebug "kernel $_release doesn't exist"