From 039c1d4dc80bef7c234c100c202841224f30d730 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Nov 09 2021 13:46:04 +0000 Subject: dracut-kdump.sh: Use stat instead of ls to get vmcore size upstream: fedora resolves: bz2003832 conflict: none commit b1c794a2cf1a4ed6c8fc2588d1e03ffcde07813c Author: Kairui Song Date: Tue Sep 14 03:00:48 2021 +0800 dracut-kdump.sh: Use stat instead of ls to get vmcore size ls output is fragile, so use stat instead. Signed-off-by: Kairui Song Acked-by: Philipp Rudo Signed-off-by: Tao Liu --- diff --git a/dracut-kdump.sh b/dracut-kdump.sh index b92854e..25972e4 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -366,7 +366,7 @@ dump_raw() dinfo "saving to raw disk $_raw" if ! $(echo -n $CORE_COLLECTOR|grep -q makedumpfile); then - _src_size=`ls -l /proc/vmcore | cut -d' ' -f5` + _src_size=$(stat --format %s /proc/vmcore) _src_size_mb=$(($_src_size / 1048576)) /kdumpscripts/monitor_dd_progress $_src_size_mb & fi diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index d6011ee..80b5582 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -1029,6 +1029,7 @@ install() { inst "/bin/head" "/bin/head" inst "/bin/awk" "/bin/awk" inst "/bin/sed" "/bin/sed" + inst "/bin/stat" "/bin/stat" inst "/sbin/makedumpfile" "/sbin/makedumpfile" inst "/sbin/vmcore-dmesg" "/sbin/vmcore-dmesg" inst "/usr/bin/printf" "/sbin/printf"