Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 922144 - app-portage/genlop: genlop -c produces inflated ETAs due to issue in average formula
Summary: app-portage/genlop: genlop -c produces inflated ETAs due to issue in average ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords: PATCH
Depends on: 926629
Blocks:
  Show dependency tree
 
Reported: 2024-01-15 02:06 UTC by Nuno Silva
Modified: 2024-03-10 05:40 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
genlop patch to adjust the average calculation and the slicing condition (genlop.patch.txt,1.48 KB, patch)
2024-01-15 02:22 UTC, Nuno Silva
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nuno Silva 2024-01-15 02:06:20 UTC
As reported in gentoo-user [1], genlop -c displays apparently incorrect ETAs, that can differ significantly from the previous merge times.

The incorrect merge time estimate in [1] (68 minutes and 27 seconds) matches the result of summing the three previous merge times and dividing by two [2].

When working with the array of merge times, the block of code where this is computed appears to use the index of the last element as the array length, causing the average issue.

Reproducible: Always

Steps to Reproduce:
1. With a clear emerge log, emerge a "big" package three times
2. Inspect the output of genlop -t, and compute the average (a) and the sum of merge times divided by two (b)
3. Build the same package a fourth time, and check the estimate calculated by genlop -c (by adding "current merge time" and "ETA").

Actual Results:  
The estimate presented by genlop -c should match (a) but will match (b).
Comment 1 Nuno Silva 2024-01-15 02:18:09 UTC
Oops, sorry, forgot this:

[1] Peter Humphrey's message of 2024-01-05: news://news.gmane.io/6020182.lOV4Wx5bFT@cube or https://marc.info/?l=gentoo-user&m=170449865110064&w=2
[2] my message of 2024-01-07: news://news.gmane.io/undsb2$app$1@ciao.gmane.io or https://marc.info/?l=gentoo-user&m=170462117718651&w=2
Comment 2 Nuno Silva 2024-01-15 02:22:52 UTC
Created attachment 882303 [details, diff]
genlop patch to adjust the average calculation and the slicing condition

An attempt to address the issue; as so far I've only rarely written/modified perl code, please let me know if there is anything that I've overlooked.

The affected code block was added in bug 658940; this patch changes the average calculation to add 1 to the denominator, and adjusts the condition used for slicing.

(I haven't yet had the chance to test this locally, though.)
Comment 3 Kai Krakow 2024-01-17 01:17:18 UTC
Yeah, it looks like "$#merge_times" returns the index of the last array element (which is zero-based), not the length of the array. Thus, your patch should be correct.

Back when I created this patch, I haven't been familiar with perl - and that didn't change until today. In that sense: LGTM
Comment 4 Holger Hoffstätte 2024-01-27 11:41:00 UTC
Can confirm that the patch returns sane estimates - thanks!
Comment 5 Larry the Git Cow gentoo-dev 2024-03-10 05:38:32 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42120a6726b6683906180fa32a69af7c716f5292

commit 42120a6726b6683906180fa32a69af7c716f5292
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-10 05:36:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-10 05:38:24 +0000

    app-portage/genlop: add 0.30.12
    
    Closes: https://bugs.gentoo.org/922144
    Signed-off-by: Sam James <sam@gentoo.org>

 app-portage/genlop/Manifest              |  1 +
 app-portage/genlop/genlop-0.30.12.ebuild | 34 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)