FS#11180 - TotalDownload percentage for first package in list reaches 100%

Attached to Project: Pacman
Opened by kane (kane) - Monday, 11 August 2008, 12:24 GMT
Last edited by Dan McGee (toofishes) - Wednesday, 20 August 2008, 00:57 GMT
Task Type Bug Report
Category Output
Status Closed
Assigned To Xavier (shining)
Dan McGee (toofishes)
Architecture All
Severity Low
Priority Normal
Reported Version 3.2.0
Due in Version 3.2.1
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info:

After enabling the TotalDownload option, the download percentage for the first package in a list of packages will go to 100%

Example Output below:

:: Retrieving packages from core...
hdparm-8.9-1-i686 48.0K 75.4K/s 00:00:01 [#####################] 100%
module-init-tools-3... 341.9K 70.9K/s 00:00:05 [#####################] 1%
kernel26-2.6.26.2-1... 25.3M 114.9K/s 00:03:46 [#####################] 82%


Steps to Reproduce:

Enable TotalDownload in pacman.conf
Download a list of packages, or perform system upgrade.

Has been replicated intermittently here http://bbs.archlinux.org/viewtopic.php?id=53256


This task depends upon

Closed by  Dan McGee (toofishes)
Wednesday, 20 August 2008, 00:57 GMT
Reason for closing:  Fixed
Additional comments about closing:  Commit 89c2c51964d5e4f297e767befb56a65c18dc3d6f
Comment by Xavier (shining) - Monday, 11 August 2008, 21:40 GMT
I figured it out, here is my proposed patch.
However, there might be a reason why the current code was like that. Is it possible that disp_percent could not be set correctly, staying at 0, even when totaldownload is enabled?
Maybe Dan was thinking about such a case, but I don't see when it could happen.
And anyway, we can't keep it like this as the current bug report shows :)
Comment by Dan McGee (toofishes) - Tuesday, 12 August 2008, 00:45 GMT
This patch seems sane to me. Looks like I was just trying to take a shortcut in the detection.

You know we can do it with a simple replacement though, right? :P
- /* use disp_percent if it is not 0, else show bar_percent */
- int p = disp_percent ? disp_percent : bar_percent;
+ /* show total download percent if option is enabled */
+ int p = config->totaldownload ? disp_percent : bar_percent;
Comment by Xavier (shining) - Tuesday, 12 August 2008, 05:46 GMT
Uh yeah of course, I updated the patch on my maint-working branch.

Loading...