Mailing List Archive

Curious about order that emerge -u builds/installs
I've noticed something surprising (to me) about the order that 'emerge -auvND world'
decides to install/upgrade/reinstall packages. The situation is as follows:

* A large number of packages need to be build/installed/reinstalled
* Hit control-C during the build of package X
* Restart 'emerge -auvND world'

I expect that it will start by building package X and resume with the
remainder of the packages in the same order as before. Often it does
not. The order of package bilds often seems to be quite different
after the interruption than it was the first time -- often X is a fair
ways down the list.

Why is that?

--
Grant
Re: Curious about order that emerge -u builds/installs [ In reply to ]
On Wed, Jun 02, 2021 at 03:22:58PM -0000, Grant Edwards wrote
> I've noticed something surprising (to me) about the order that 'emerge -auvND world'
> decides to install/upgrade/reinstall packages. The situation is as follows:
>
> * A large number of packages need to be build/installed/reinstalled
> * Hit control-C during the build of package X
> * Restart 'emerge -auvND world'
>
> I expect that it will start by building package X and resume with the
> remainder of the packages in the same order as before. Often it does
> not. The order of package bilds often seems to be quite different
> after the interruption than it was the first time -- often X is a fair
> ways down the list.
>
> Why is that?

See the "Emerge order not deterministic !?" thread from way back in 2015.
https://linux.gentoo.user.narkive.com/YlGA5QBQ/gentoo-user-emerge-order-not-deterministic
I remember it, because I was the OP on that thread. Basically, if there
isn't a dependancy requirement between two packages, there's no
guarantee which one gets emerged first.

--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
Re: Curious about order that emerge -u builds/installs [ In reply to ]
Hi Grant,

On 2021-06-02 15:22, Grant Edwards wrote:
> The order of package bilds often seems to be quite different after the
> interruption than it was the first time -- often X is a fair ways down
> the list.
>
> Why is that?

it might possibly be related to hash randomization. I experienced a
similar "problem" during work some time ago, where I couldn't reliably
compare a set of values with a predefined list, without sorting it
first.

You can try the following Bash script to demonstrate the effects of hash
randomization in Python:

for _ in {1..5}; do python -c "print(set(['a', 'b', 'c']))"; done

Chances are high that you will get five completely differently sorted
sets.

Since Portage is programmed in Python, it might be the same effect here,
the packages are built up in a set or a dictionary and are therfore
affected by the random seed.

More information and pointers on this topic can be found in the Python
documentation: https://docs.python.org/3/using/cmdline.html#cmdoption-r

--
Regards and all the best

Flo