[pacman-dev] Broken pacman output when resizing

Allan McRae allan at archlinux.org
Sun Nov 29 13:04:16 UTC 2015


On 29/11/15 22:14, Constantin Weißer wrote:
> Hi there!
> 
> As probably everyone noticed one time or the other, pacman output (in
> particular progress bars) breaks whenever one resizes the terminal,
> which leads to scrambled output like this:
> 
> https://paste.xinu.at/LNo/plain
> 
> This is due to the fact, that pacman always claims the whole terminal
> width.  Whenever one runs pacman in tmux (split pane) or uses a tiling
> wm, resizing happens quite often and will produce such broken output.
> 
> Considering the output closely, we have quite some "uninteresting"
> information there. All the 100% progress bars are actually redundant as
> pacman does not continue installation (or download) if it cannot
> retrieve a package.  Also, it only downloads one package at a time, so
> we only really care about the progress of the last package (or total
> progress). I thus propose a different output:
> 
> https://paste.xinu.at/m-5XEa/
> 
> version1 uses a fixed 100 columns output, version2 a fixed 80 columns
> output. In version1 it is possible to draw the per package progress at
> the same line as the package name. When complete, only the package name
> remains.
> In both versions the currently downloaded package is always
> the last line of the output. Both proposals contain an example for per
> package and total progress.  I'm personally in favour of version2,
> because it seems safe to assume that we always have 80 cols available
> and it also unifies the output style for both per package and total
> progress.
> 
> To sum up the changes shown in the mockups, I propose:
> 
> * progress bars of database synchronising, download and installation
>   move on line below compared with the current output
> * when a step is complete, the line with the package (or step) name
>   remains, but without any width-dependent progress bars. For download,
>   you find and example in the link above.  For installation a finished
>   steop could look like this:
> 
>   (26/63) upgrading opus
> 
>   So basically just the redundant progress bar is removed here.
> 
> * The output is limited to 80 columns which should fit nicely as seen in
>   the example.
> * Other output (such as warnings, errors, new optional deps, ...)
>   remains the same.
> 
> Is there any interest for such a change? If so, I could develop and
> provide a patch. I'm also happy about comments, fine-tuning and further
> improvements to the proposal.
> 

Pacman's output only goes weird if the terminal width is made smaller,
and even then only sometimes.  My guess is there is a race condition
between the time the width is calculated and when the output is printed.
 If the terminal is shrunk in that time, the output goes over two lines
and on the next update only the second line is overridden.

How do you intend to stop this?  While your example looks fine, you will
still get partial progress bars everywhere in the output when the
terminal shrinks.

Also, we need to consider parallel downloads (this will happen in the
future).

A


More information about the pacman-dev mailing list