Revert "kdumpctl: improve "while read" time for /etc/kdump.conf"

Resolves: bz1449801

"cat $KDUMP_CONFIG_FILE|grep -v "^#"|while read ..." use pipes
to invoke subshells, as a result we met "the dreaded inaccessible
variables within a subshell problem" as described in the book
"Advanced Bash-Scripting Guide".

It cause regressions, so revert it.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Xunlei Pang 2017-05-11 13:44:28 +08:00 committed by Dave Young
parent c3ab408727
commit 7f725ef13a
1 changed files with 5 additions and 5 deletions

View File

@ -365,11 +365,11 @@ check_config()
return 1
}
cat $KDUMP_CONFIG_FILE | grep -v "^#" | while read config_opt config_val; do
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
"")
\#* | "")
;;
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && {
@ -386,7 +386,7 @@ check_config()
return 1;
;;
esac
done
done < $KDUMP_CONFIG_FILE
check_default_config || return 1
@ -799,7 +799,7 @@ load_kdump()
check_ssh_config()
{
cat $KDUMP_CONFIG_FILE | grep -v "^#" | while read config_opt config_val; do
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
@ -820,7 +820,7 @@ check_ssh_config()
*)
;;
esac
done
done < $KDUMP_CONFIG_FILE
#make sure they've configured kdump.conf for ssh dumps
local SSH_TARGET=`echo -n $DUMP_TARGET | sed -n '/.*@/p'`