[kexec-tools/f19] Strip inline comments from the kdump config file before use

Baoquan He baoquan at fedoraproject.org
Fri Sep 27 11:07:58 UTC 2013


commit 45ef0c707655932567498e8e722cb5764d4cc93a
Author: Baoquan He <bhe at redhat.com>
Date:   Thu Sep 26 19:46:48 2013 +0800

    Strip inline comments from the kdump config file before use
    
    From: Wade Mealing <wmealing at redhat.com>
    
    The RHEL 5 release of mkdumprd allowed for comments in the kdump config
    file as shown below:
    
    net 192.168.1.1 # this is the comment part
    
    This patch strips them out during processing, but leaves the configuration
    file in original condition.
    
    Signed-off-by: Wade Mealing <wmealing at redhat.com>
    Signed-off-by: Baoquan He <bhe at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 dracut-kdump.sh        |    4 ++++
 dracut-module-setup.sh |    2 ++
 kdumpctl               |    6 ++++++
 mkdumprd               |    2 ++
 4 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 84dd72e..f38891d 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -226,6 +226,8 @@ read_kdump_conf()
     # first get the necessary variables
     while read config_opt config_val;
     do
+        # remove inline comments after the end of a directive.
+        config_val=$(strip_comments $config_val)
         case "$config_opt" in
         path)
         KDUMP_PATH="$config_val"
@@ -269,6 +271,8 @@ read_kdump_conf()
     # rescan for add code for dump target
     while read config_opt config_val;
     do
+        # remove inline comments after the end of a directive.
+        config_val=$(strip_comments $config_val)
         case "$config_opt" in
         ext[234]|xfs|btrfs|minix|nfs)
             add_dump_code "dump_fs $config_val"
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 10ecec6..c013430 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -245,6 +245,8 @@ kdump_install_conf() {
 
     while read config_opt config_val;
     do
+        # remove inline comments after the end of a directive.
+        config_val=$(strip_comments $config_val)
         case "$config_opt" in
         ext[234]|xfs|btrfs|minix|raw)
             sed -i -e "s#$config_val#$(kdump_to_udev_name $config_val)#" /tmp/$$-kdump.conf
diff --git a/kdumpctl b/kdumpctl
index d62b4b4..358ef05 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -10,6 +10,8 @@ SAVE_PATH=/var/crash
 SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
 DUMP_TARGET=""
 
+. /lib/kdump/kdump-lib.sh
+
 standard_kexec_args="-p"
 
 if [ -f /etc/sysconfig/kdump ]; then
@@ -106,6 +108,8 @@ function check_config()
 	}
 
 	while read config_opt config_val; do
+               # remove inline comments after the end of a directive.                                                                      
+               config_val=$(strip_comments $config_val)
 		case "$config_opt" in
 		\#* | "")
 			;;
@@ -263,6 +267,8 @@ function load_kdump()
 function check_ssh_config()
 {
 	while read config_opt config_val; do
+               # remove inline comments after the end of a directive.
+               config_val=$(strip_comments $config_val)
 		case "$config_opt" in
 		sshkey)
 			if [ -f "$config_val" ]; then
diff --git a/mkdumprd b/mkdumprd
index ea84df5..3e6061e 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -506,6 +506,8 @@ fi
 
 while read config_opt config_val;
 do
+    # remove inline comments after the end of a directive.
+    config_val=$(strip_comments $config_val)
     case "$config_opt" in
     extra_modules)
         extra_modules="$extra_modules $config_val"


More information about the scm-commits mailing list