More progress bar weirdness

George Boudreau georgeb at linuxfromscratch.org
Thu Sep 14 05:48:30 PDT 2006


Dan Nicholson wrote:
> Hi guys,
> 
> I'm stil not sure if this is a terminal issue or something wrong with
> progress-bar.sh (not an issue with PIDs, thankfully :). Sometimes I'll
> come back and the bar is progressing across AND down the screen. Seems
> to only happen for really long running targets. Potentially, the 100
> min mark triggers this (I have a really slow machine). I don't really
> understand the DEC scheme, so I'm wary of trying to debug it. Do you
> guys have any ideas? You can see a screenshot here:

   I didn't have a chance to view your screenshot before I closed down 
for the night but I suspected this might be the case for you. This line 
of code:

   write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec. "

moves the cursor to the time printout region of the line (TS_POSITION) 
and writes the minutes and seconds that have elapsed. The problem you 
are seeing is character wraparound caused by the line length exceeding 
80 chars.

Try this small change:

   write_or_exit "${TS_POSITION}$(($SECONDS / 60)) min. $SEC sec"

and if it works for you, removing  the trailing ". ", I will make the 
change. (I could force 'no-wrap' on the terminal but that hides the 
problem of line length)

  The term 'Control Sequence Introducer' is/was Digital Equipment Corp's 
(the originator of the VT100) fancy way of saying <ESC>[ . A full list 
of xterm/VT100 control codes can be found at: 
http://rtfm.etla.org/xterm/ctlseq.html

> 
> http://anduin.linuxfromscratch.org/~dnicholson/progress.png
> 
> -- 
> Dan




More information about the alfs-discuss mailing list