From f3914a98a6c9bb8fde3655d6705c416ea24ca764 Mon Sep 17 00:00:00 2001 From: Dave Young Date: Wed, 14 Nov 2012 13:56:50 +0800 Subject: [PATCH] kdump option space checking improvement We can use not only space but also tab as whitespace, so s/\ /[[:blank:]] for checking the whitespace The last commit is intend for checking multiple dump target, and differentiate ssh and sshkey options. This issue is only for ssh, so no need to add [[:blank:]] for other dump types to create a very long code line. [v1->v2]: use [[:blank:]] instead of [[:space:]] see expanation in below doc: http://en.wikipedia.org/wiki/Regular_expression#POSIX_character_classes [:blank:] [ \t] Space and tab [:space:] [ \t\r\n\v\f] Whitespace characters Tested the [:blank:] works well as [:space:] Signed-off-by: Dave Young Acked-by: Vivek Goyal CC: Cong Wang --- dracut-kdump.sh | 2 +- kdumpctl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 2999073..faeb7c5 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -115,7 +115,7 @@ dump_ssh() is_ssh_dump_target() { - grep -q "^ssh.*@" $conf_file + grep -q "^ssh[[:blank:]].*@" $conf_file } is_raw_dump_target() diff --git a/kdumpctl b/kdumpctl index 640349d..3e6618b 100755 --- a/kdumpctl +++ b/kdumpctl @@ -364,7 +364,7 @@ function save_raw() function start() { local nr - nr=$(awk 'BEGIN{cnt=0} /^raw |^ssh |^nfs |^ext[234] |^xfs |^btrfs |^minix /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) + nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) [ $nr -gt 1 ] && { echo -n "Error: More than one dump targets specified"; echo return 1