[PATCHv2] kdumpctl: Fix the matching of plus symbol by grep's EREs
by Pingfan Liu
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 <piliu(a)redhat.com>
---
v1 -> v2
add test case
kdumpctl | 3 +++
spec/kdumpctl_general_spec.sh | 17 +++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 48cd33d..f86a365 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1406,6 +1406,9 @@ _filter_grubby_kernel_str()
_find_kernel_path_by_release()
{
local _release="$1" _grubby_kernel_str _kernel_path
+
+ # Insert '/' before '+' to cope with grep's EREs
+ _release=$(echo "$_release" | sed 's/+/\\+/g')
_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
diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh
index bb5755c..7304cd4 100644
--- a/spec/kdumpctl_general_spec.sh
+++ b/spec/kdumpctl_general_spec.sh
@@ -222,6 +222,23 @@ Describe 'kdumpctl'
End
End
+ Describe '_find_kernel_path_by_release()'
+ grubby() {
+ echo -e 'kernel="/boot/vmlinuz-6.2.11-200.fc37.x86_64"\nkernel="/boot/vmlinuz-5.14.0-322.el9.aarch64"\nkernel="/boot/vmlinuz-5.14.0-316.el9.aarch64+64k"'
+ }
+
+ Parameters
+ # parameter answer
+ vmlinuz-6.2.11-200.fc37.x86_64 /boot/vmlinuz-6.2.11-200.fc37.x86_64
+ vmlinuz-5.14.0-322.el9.aarch64 /boot/vmlinuz-5.14.0-322.el9.aarch64
+ vmlinuz-5.14.0-316.el9.aarch64+64k /boot/vmlinuz-5.14.0-316.el9.aarch64+64k
+ End
+ It 'returns the kernel path for the given release'
+ When call _find_kernel_path_by_release "$1"
+ The output should equal "$2"
+ End
+ End
+
Describe 'parse_config()'
bad_kdump_conf=$(mktemp -t bad_kdump_conf.XXXXXXXXXX)
cleanup() {
--
2.31.1
11 months, 3 weeks
[PATCH] kdump.conf: redirect unknown architecture warning to stderr
by Lichen Liu
The warning messages should not be included in the generated files.
Redirecting the warning for an unknown architecture to stderr.
Signed-off-by: Lichen Liu <lichliu(a)redhat.com>
---
gen-kdump-conf.sh | 2 +-
gen-kdump-sysconfig.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gen-kdump-conf.sh b/gen-kdump-conf.sh
index a9f124f..4abcd39 100755
--- a/gen-kdump-conf.sh
+++ b/gen-kdump-conf.sh
@@ -224,7 +224,7 @@ s390x)
x86_64) ;;
*)
- echo "Warning: Unknown architecture '$1', using default kdump.conf template."
+ echo "Warning: Unknown architecture '$1', using default kdump.conf template." >&2
;;
esac
diff --git a/gen-kdump-sysconfig.sh b/gen-kdump-sysconfig.sh
index 5a16e92..4a28350 100755
--- a/gen-kdump-sysconfig.sh
+++ b/gen-kdump-sysconfig.sh
@@ -107,7 +107,7 @@ x86_64)
"irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0"
;;
*)
- echo "Warning: Unknown architecture '$1', using default sysconfig template."
+ echo "Warning: Unknown architecture '$1', using default sysconfig template." >&2
;;
esac
--
2.40.1
11 months, 3 weeks
[PATCH] mkdumprd: Use the correct syntax to redirect the stderr to null
by Coiby Xu
A space was added by mistake and unfortunately fips-mode-setup refuses
an extra parameter,
# fips-mode-setup --is-enabled 2 > /dev/null
# echo $?
2
# fips-mode-setup --is-enabled 2
Check, enable, or disable the system FIPS mode.
usage: /usr/bin/fips-mode-setup --enable|--disable [--no-bootcfg]
usage: /usr/bin/fips-mode-setup --check
usage: /usr/bin/fips-mode-setup --is-enabled
So in this case mkdumprd can never detect if FIPS is enabled. Fix this
mistake.
Fixes: 443a43e0 ("mkdumprd: call dracut with --add-device to install the drivers needed by /boot partition automatically for FIPS")
Signed-off-by: Coiby Xu <coxu(a)redhat.com>
---
mkdumprd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdumprd b/mkdumprd
index 3932a1fd..f93874d3 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -464,7 +464,7 @@ if ! is_fadump_capable; then
add_dracut_arg "--no-hostonly-default-device"
- if fips-mode-setup --is-enabled 2 > /dev/null; then
+ if fips-mode-setup --is-enabled 2> /dev/null; then
add_dracut_arg --add-device "$(findmnt -n -o SOURCE --target /boot)"
fi
fi
--
2.40.1
12 months
[PATCH] kdumpctl: Fix the matching of plus symbol by grep's EREs
by Pingfan Liu
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 <piliu(a)redhat.com>
---
kdumpctl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 20ed7bf..5c55a6a 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1406,6 +1406,8 @@ _filter_grubby_kernel_str()
_find_kernel_path_by_release()
{
local _release="$1" _grubby_kernel_str _kernel_path
+
+ _release=$(echo "$_release" | sed 's/+/\+/g')
_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
--
2.31.1
12 months