[kexec-tools] get_ssh_size fix for localized df output
WANG Chao
wangchao at fedoraproject.org
Fri Mar 14 05:05:24 UTC 2014
commit fc1749219f708e762fcf3b12300d7f954a7778ab
Author: Dave Young <dyoung at redhat.com>
Date: Thu Mar 13 14:09:15 2014 +0800
get_ssh_size fix for localized df output
When kdump service is started, /sbin/mkdump checks if there is enough
free space on the ssh server using "df -P" command.
However, the slight difference in the first line of the "df -P" command
output for English and Japanese environment causes a problem.
-----
# LANG=en_us.utf8 df -P | head -1
Filesystem 1024-blocks Used Available Capacity Mount on
# LANG=ja_JP.utf8 df -P | head -1
ファイルシス 1024-ブロック 使用 使用可 容量 マウント位置
-----
Because the number of words is 7 in the English output and 6 in
Japanese, the subsequent awk command could not correctly locate the
free space field and results in an error.
One way to fix it is use df -P /var/crash|tail -1, but for remote restricted
shell pipe is not supported. Thus fix this by print field NF-2 in awk script.
Signed-off-by: Dave Young <dyoung at redhat.com>
Acked-by: WANG Chao <chaowang at redhat.com>
Acked-by: Vivek Goyal <vgoyal at redhat.com>
mkdumprd | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/mkdumprd b/mkdumprd
index 241a426..bb1e01e 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -142,8 +142,9 @@ get_ssh_size() {
[ $? -ne 0 ] && {
perror_exit "checking remote ssh server available size failed."
}
- #ssh output removed the line break, so print $11 instead of $4
- _size=$(echo -n $_out|tail -1 | awk '{print $11}')
+
+ #ssh output removed the line break, so print field NF-2
+ _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}')
echo -n $_size
}
More information about the scm-commits
mailing list