Comment 6 for bug 1003938

Revision history for this message
Daniel Hahler (blueyed) wrote :

For what it's worth: I am experiencing this on my Synology Diskstation DS212+ (armv5tel), but not on my notebook, which is more powerful.

A few observations:
 - "read < file" returns with exit code 1 on zsh, if there is no newline in the file (and therefore not a whole "line" has been read). This has to be changed, either by adding a newline to the printf or by comparing the read value instead of setting it to 0 always in that case.
 - there should be locking, either around the "tmux set" calls, or even better around the calls to byobu-status.
 - the adjustment of width should probably only happen with $1=tmux_left, and not for tmux_right at nearly the same time. This might be true for most of the byobu-status script: with tmux, it gets called twice nearly at the same time, with different argument.

I am pasting the diff from me fiddling around with this code, for inspiration:

diff --git i/lib/byobu/usr/bin/byobu-status w/lib/byobu/usr/bin/byobu-status
index b3bec70..0e76660 100755
--- i/lib/byobu/usr/bin/byobu-status
+++ w/lib/byobu/usr/bin/byobu-status
@@ -36,17 +36,26 @@ for i in "${BYOBU_PREFIX}/share/$PKG/status/status" "${BYOBU_PREFIX}/share/$PKG/
 done

 # Fix status printing for small terminal sizes
+if [ "$1" = "tmux_left" ]; then
 width=$(tmux list-windows -F "#{session_width}")
+if [ ! -e "$BYOBU_RUN_DIR/lock.set-width" ]; then
+ touch "$BYOBU_RUN_DIR/lock.set-width"
+ date >> /tmp/byobu.log
 w_last=0
 [ -r "$BYOBU_RUN_DIR/width" ] && read w_last < $BYOBU_RUN_DIR/width 2>/dev/null 1>&2 || w_last=0
 for w in $width; do
+ echo $w / $w_last >> /tmp/byobu.log
        if [ "$w" != "$w_last" ]; then
                tmux set -g status-left-length $(($w*1/4)) >/dev/null 2>&1
+ sleep 5
                tmux set -g status-right-length $(($w*3/4)) >/dev/null 2>&1
- printf "$w" > $BYOBU_RUN_DIR/width
+ printf "$w\n" > $BYOBU_RUN_DIR/width # newline is important for read in zsh
                break
        fi
 done
+ rm "$BYOBU_RUN_DIR/lock.set-width"
+fi
+fi

 case "$BYOBU_BACKEND" in
        screen)

There is still a hangup of the "tmux set" call, but at least it does not pile up anymore and the status gets updated after all.