Kdump scirpt already have default values for core_collector, path in many other place. Empty kdump.conf still works. Fix this corner case and fix the error message.
Signed-off-by: Kairui Song kasong@redhat.com --- kdumpctl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 81448be..00703f2 100755 --- a/kdumpctl +++ b/kdumpctl @@ -238,12 +238,7 @@ restore_default_initrd() check_config() { local -A _opt_rec - while read config_opt config_val; do - if [ -z "$config_val" ]; then - derror "Invalid kdump config value for option $config_opt" - return 1 - fi - + while read -r config_opt config_val; do case "$config_opt" in dracut_args) if [[ $config_val == *--mount* ]]; then @@ -269,12 +264,20 @@ check_config() derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives." return 1 ;; + '') + continue + ;; *) derror "Invalid kdump config option $config_opt" return 1 ;; esac
+ if [[ -z "$config_val" ]]; then + derror "Invalid kdump config value for option '$config_opt'" + return 1 + fi + if [ -n "${_opt_rec[$config_opt]}" ]; then if [ $config_opt == _target ]; then derror "More than one dump targets specified"
On 4/14/21 1:41 PM, Kairui Song wrote:
Kdump scirpt already have default values for core_collector, path in many other place. Empty kdump.conf still works. Fix this corner case and fix the error message.
Signed-off-by: Kairui Song kasong@redhat.com
kdumpctl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 81448be..00703f2 100755 --- a/kdumpctl +++ b/kdumpctl @@ -238,12 +238,7 @@ restore_default_initrd() check_config() { local -A _opt_rec
- while read config_opt config_val; do
if [ -z "$config_val" ]; then
derror "Invalid kdump config value for option $config_opt"
return 1
fi
- while read -r config_opt config_val; do case "$config_opt" in dracut_args) if [[ $config_val == *--mount* ]]; then
@@ -269,12 +264,20 @@ check_config() derror "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives." return 1 ;;
'')
continue
;;
*) derror "Invalid kdump config option $config_opt" return 1 ;; esac
if [[ -z "$config_val" ]]; then
derror "Invalid kdump config value for option '$config_opt'"
return 1
fi
if [ -n "${_opt_rec[$config_opt]}" ]; then if [ $config_opt == _target ]; then derror "More than one dump targets specified"
Acked-by: Pingfan Liu piliu@redhat.com