From cb3d1c1c3f8e6060467701d3f33f6e5c18d119a2 Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Fri, 22 Sep 2017 16:30:05 +0530 Subject: [PATCH] kdumpctl: Error out in case there are white spaces before an option name Resolves: BZ1484945 https://bugzilla.redhat.com/show_bug.cgi?id=1484945 Currently the kdumpctl script doesn't handle whitespaces (including TABs) which might be there before an option name in the kdump.conf This patch addresses this issue, by ensuring that the kdumpctl errors out in case it finds any stray space(s) or tab(s) before a option name. Reported-by: Kenneth D'souza Signed-off-by: Bhupesh Sharma Acked-by: Pratyush Anand Acked-by: Dave Young --- kdumpctl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kdumpctl b/kdumpctl index 7d06efe..d4e0050 100755 --- a/kdumpctl +++ b/kdumpctl @@ -364,6 +364,13 @@ check_config() return 1 } + # Check if we have any leading spaces (or tabs) before the + # variable name in the kdump conf file + if grep -E -q '^[[:blank:]]+[a-z]' $KDUMP_CONFIG_FILE; then + echo "No whitespaces are allowed before a kdump option name in $KDUMP_CONFIG_FILE" + return 1 + fi + while read config_opt config_val; do case "$config_opt" in \#* | "")