From e991e535e44a7809c9150d32527ca6fa3d2baba3 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 11 Jun 2019 19:01:41 -0500 Subject: [PATCH] * usr/lib/byobu/disk_io: - ensure some values are set to zero, if unreadable - fixes a bug where disk_io causes the rest of the status line to fail --- debian/changelog | 3 +++ usr/lib/byobu/disk_io | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c3ff24c0..7b96ffe3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,9 @@ byobu (5.128) unreleased; urgency=medium - prefer iwconfig over iw for now, iw is not working for me * usr/share/byobu/profiles/tmux: - flatten some of our color configuration to match the new tmux format + * usr/lib/byobu/disk_io: + - ensure some values are set to zero, if unreadable + - fixes a bug where disk_io causes the rest of the status line to fail [ Fede Luzzi ] * usr/lib/byobu/include/mondrian, usr/share/byobu/profiles/tmux: diff --git a/usr/lib/byobu/disk_io b/usr/lib/byobu/disk_io index 44db71ad..c6c6e02e 100755 --- a/usr/lib/byobu/disk_io +++ b/usr/lib/byobu/disk_io @@ -62,15 +62,15 @@ __disk_io() { if [ $t2 -le $t1 ]; then rate=0 else - [ -r "$cache" ] && read x1 < "$cache" + [ -r "$cache" ] && read x1 < "$cache" || x1=0 local a1= a2= a3= a4= a5= a6= a7= a8= a9= a10= read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 other < "/sys/block/$disk/stat" if [ "$i" = "read" ]; then symbol="$ICON_RD" - x2="$a3" + [ -n "$a3" ] && x2="$a3" || x2=0 else symbol="$ICON_WR" - x2="$a7" + [ -n "$a7" ] && x2="$a7" || x2=0 fi printf "%s" "$x2" > "$cache" rate=$((($x2 - $x1) / ($t2 - $t1) * 512 / 1024))