Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 934126 - Emerge --updates --rebuild-if-* doesn't conduct the same builds as an interrupted emerge --update -rebuild-if-*
Summary: Emerge --updates --rebuild-if-* doesn't conduct the same builds as an interru...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-12 08:23 UTC by Michael Jones
Modified: 2024-06-13 19:24 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Jones 2024-06-12 08:23:42 UTC
with these emerge options:

--jobs --keep-going --newrepo --newuse --changed-use --changed-deps --changed-slot --deep --tree --unordered-display --backtrack=3000 --complete-graph --with-bdeps=y --rebuild-if-new-rev --rebuild-if-new-ver --rebuild-if-unbuilt --rebuilt-binaries --binpkg-respect-use=y --binpkg-changed-deps=y --usepkg=y

I regularly see many dozens of packages scheduled for rebuild because one of their dependencies is updated (this is desired for me).

However, if the emerge process is interrupted (e.g. system reboot), running emerge a second time, with identical options, does not result in the list of packages to be merged being complete when compared to the first run.

What appears to be happening here is that emerge is calculating the packages to rebuild based on the packages currently scheduled for rebuild / update / changed use, but there's no way to ask emerge to force the whole system to be made consistent.


Potentially a way to address this would be to track the versions, use flags, and recursive dependencies (with use flags and versions) of each package. This would allow the ability to detect when an installed package is in need of rebuilding based on comparing against the other packages installed on the system

Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2024-06-12 14:01:45 UTC
The large --backtrack=3000 value shows that it is difficult for the dependency resolver to converge on an "optimal" state for your system.

(In reply to Michael Jones from comment #0)
> However, if the emerge process is interrupted (e.g. system reboot), running
> emerge a second time, with identical options, does not result in the list of
> packages to be merged being complete when compared to the first run.

If you can use package.mask entries to limit the search space, then that should help reduce the backtracking and lead to more reproducible results.

> What appears to be happening here is that emerge is calculating the packages
> to rebuild based on the packages currently scheduled for rebuild / update /
> changed use, but there's no way to ask emerge to force the whole system to
> be made consistent.

Every single calculation aims for a consistent state, as long as you have not used --complete-graph=n.

> Potentially a way to address this would be to track the versions, use flags,
> and recursive dependencies (with use flags and versions) of each package.
> This would allow the ability to detect when an installed package is in need
> of rebuilding based on comparing against the other packages installed on the
> system

I'm not sure what you're getting at here, since we already track all the versions, use flags, and dependencies that are relevant.
Comment 2 Michael Jones 2024-06-13 04:18:25 UTC
> The large --backtrack=3000 value shows that it is difficult for the dependency resolver to converge on an "optimal" state for your system.

I'm not really following. This option was added because portage was regularly failing to resolve dependencies, but it's been there for many years. Is there some problem with this option?

> If you can use package.mask entries to limit the search space, then that should help reduce the backtracking and lead to more reproducible results.

Could you elaborate on how this relates to a second run of emerge fails to rebuild packages which were (in the first run) scheduled for rebuild because one of their dependencies was rebuilt?

> Every single calculation aims for a consistent state, as long as you have not used --complete-graph=n.

> I'm not sure what you're getting at here, since we already track all the versions, use flags, and dependencies that are relevant.

I mean, this is obviously not the case, at least for what I'm referring to.

The problem here is that if, for example, glibc is updated to a new version, emerge will schedule some 300 packages for rebuild. 

If I let emerge rebuild 100 of those 300, and then my system reboots, re-running emerge with the exact same arguments might say that there's nothing to do, or only 5-10 packages need rebuilt.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-13 04:27:27 UTC
It's very possible it's a specific defect of --rebuild-if-new* or similar. It's hard to know without example output (or, ideally, a reduced testcase).

You only gave details of an example scenario just now.
Comment 4 Michael Jones 2024-06-13 04:32:42 UTC
Is there a specific option i can set, or log file I can save, that will help demonstrate what I'm referring to the next time I reproduce this problem?

I thought I had provided enough context to explain what was going on, but it's a difficult to describe problem.
Comment 5 Zac Medico gentoo-dev 2024-06-13 19:23:03 UTC
Oh right, the -rebuild-if-* options are not going to trigger rebuilds for past updates if emerge is interrupted.

However, you could use emerge --resume to salvage the previous package list.