[kexec-tools/f18: 2/7] kdump option space checking improvement

Dave Young yangrr at fedoraproject.org
Fri Nov 16 06:24:44 UTC 2012


commit f3914a98a6c9bb8fde3655d6705c416ea24ca764
Author: Dave Young <dyoung at redhat.com>
Date:   Wed Nov 14 13:56:50 2012 +0800

    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 <dyoung at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>
    CC: Cong Wang <amwang at redhat.com>

 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


More information about the scm-commits mailing list