| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
We added a close(iFd) after assigning iFd to Fd which
is wrong.
Regression-Of: e79f9bb22375fd72330b534e17dcd3ceace432e8
Closes: #1136441
|
| |
|
|
|
|
|
| |
We inadvertently changed a CreateDynamicMMap call.
Fix that function instead.
Regression-of: 23dba65f031954df896bc3c6dfb1a9705574886b
|
| | |
|
| |
|
|
|
|
|
| |
We accidentally followed "keepauto" and friends earlier, breaking
`apt why` for suggested packages.
Reported-By: uau on IRC
|
| | |
|
| |
|
|
| |
Static analysis has shown that there are many minor memleaks.
|
| |
|
|
|
|
|
|
|
| |
If apt update is interrupted during transaction commit, the system may
end up with updated InRelease that does not match the other list files,
which can cause apt to believe that the lists are already up-to-date when
they are in fact not.
Closes: #1078608
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Ongoing Run can be cancelled by returning false from ::Pulse(). In this case
the items would still be called pkgAcquire::Item::Finished() as usual, causing
pkgAcqMetaClearSig to commit the incomplete transaction anyway as at that
point it's still Started and has no errors.
Add a pkgAcquire::Item::Cancelled() method and use it in pkgAcqMetaClearSig
to abort the transaction.
Closes: #1078608
|
| | |
|
| |
|
|
|
|
|
| |
References:
- https://stackoverflow.com/questions/79700634/pros-and-cons-of-make-unique-vs-direct-constructor-call-in-c17
- https://towardsdev.com/why-std-make-unique-beats-new-in-modern-c-7e2ba653737e
- https://www.sololearn.com/en/Discuss/3334779/where-make_unique-is-better-than-unique_ptrraw-pointer
|
| |
|
|
|
|
| |
References:
- https://www.reddit.com/r/cpp_questions/comments/pm63yx/why_clangtidy_says_use_emplace_back_instead_of/
- https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-emplace.html
|
| | |
|
| |
|
|
|
|
|
|
| |
Benchmark:
- https://stackoverflow.com/questions/62058906/why-my-performance-benchmark-gives-me-wrong-results
References:
- https://clang.llvm.org/extra/clang-tidy/checks/performance/prefer-single-char-overloads.html
|
| |
|
|
|
|
|
|
|
| |
std::basic_string_view should not be initialized locally, only
in the std library. Replace it with a simple span instead.
This should fix compilation with LLVM 18+.
Supersedes: https://salsa.debian.org/apt-team/apt/-/merge_requests/511
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously a package with Phased-Update-Percentage: n would be updated
with probability (n + 1)/101 instead of n/100. For example, a package
with Phased-Update-Percentage: 0 could still be updated even though it
shouldn’t, and a package with Phased-Update-Percentage: 1 would be
installed almost twice as much as it should be. Correct the erroneous
math.
Note that libstdc++ implements std::uniform_int_distribution in such a
way that for a given seed, changing dist(0, 100) to dist(0, 99) has
the effect of decreasing each sample by 0 or 1; therefore, this patch
will not randomly trigger extra phased updates that had previously
been excluded.
Fixes: c5bc86d45e003905ef411146e66b414d26fb1ff8
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
|
| | |
|
| |
|
|
|
| |
As long as we are running dpkg, keep an inhibitor that
blocks us from sleeping.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement the "APT::Get::Upgrade-By-Source-Package" option as
the classic solver does.
Here this is equally straight forward now: We enqueue optional, but
eager, clauses of the form
foo=2 -> foo-data=2
for each sibling in the source version, assuming they are currently
installed, and the selection is not the current version.
This softly enforces upgrades of already installed siblings, but
in non-strict-pinning mode it will not affect the selection of
new packages to be installed.
A more complete solution to version selection by source package
also seems feasible, where we change the "priority" of versions
in the solver dynamically - currently they are statically evaluated.
Such that, when you select foo=2, and something installs foo-data,
foo-data would be installed in version 2 even if version 3 were its
candidate.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Aside from Clause, which initializes an std::vector
and an std::forward_list, which do not have constexpr
constructors in C++17, we can turn our inline functions
constexpr.
Using `constexpr` implies `inline`, so simplify that
accordingly where needed.
Adding noexcept to the function allows STL components
to utilize more optimized code paths.
Marking SameOrGroup as constexpr significantly improves
performance due to being in the hot path and it now being
inlined - removing branching by 10%.
iolveiolver
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, map_pointer and iterators are now
all literal types, with most functions translated
to constexpr noexcept.
This allows them to be used in constexpr contexts
in C++17; and the compiler to generate better code
knowing they cannot throw exceptions.
This transformation is safe, because the functions
are inline.
more constexpr
|
| |
|
|
|
| |
This reduces its memory usage by half and turns it into a
fast map - no destructors needed (and 0 initialization).
|
| | |
|
| |
|
|
|
|
|
| |
The for loop with if(foo) continue; return false; was highly
unusual as were the bunch of uses of `!` instead of `not`.
Gbp-dch: ignore
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were trying to compare the dependencies in the first version
with the dependencies in later version, but our loop started
at the first version as well due to an oversight in the use
of the increment operator.
Change the increment from postfix to prefix such that we start
iterating with the 2nd version in the list only.
This should yield minute performance optimizations:
before:
12: 17.80% 0.00% apt libapt-pkg.so.7.0.0 [.] EDSP::ResolveExternal(char const*, pkgDepCache&, unsigned int, OpProgress*)
14: --17.80%--EDSP::ResolveExternal(char const*, pkgDepCache&, unsigned int, OpProgress*)
20: | | |--6.34%--APT::Solver::DependencySolver::RegisterCommonDependencies(pkgCache::PkgIterator)
44: | | --0.85%--APT::Solver::DependencySolver::RegisterCommonDependencies(pkgCache::PkgIterator)
after:
12: 16.98% 0.00% apt libapt-pkg.so.7.0.0 [.] EDSP::ResolveExternal(char const*, pkgDepCache&, unsigned int, OpProgress*)
14: --16.98%--EDSP::ResolveExternal(char const*, pkgDepCache&, unsigned int, OpProgress*)
20: | | |--5.65%--APT::Solver::DependencySolver::RegisterCommonDependencies(pkgCache::PkgIterator)
42: | | --0.70%--APT::Solver::DependencySolver::RegisterCommonDependencies(pkgCache::PkgIterator)
|
| |
|
|
|
|
|
|
|
| |
Calculate the head and the tail of the clause in Propagate() and
check based on that if the clause is conflict/unit/undecided.
Special care has been taken to avoid the calculation of tail
when it is not necessary by placing it inside a helper lambda;
as well as skipping the calculation when the clause is inactive.
|
| |
|
|
|
|
|
| |
It used to be that we reached conflict clauses from the Solve()
loop, however that is no longer the case, so remove the else
branch, and turn the `else if (item.clause->optional)` into
a new `else` with an `assert(item.clause->optional)`.
|
| |
|
|
|
|
|
|
| |
Introduce a scoped object that starts measuring performance counters
and then dumps them into a JSONL file for later analysis.
Add performance contexts for APT::Solver and pkgDepCache::Init()
as starting points.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of tracking dependencies and reverse dependencies,
install classical watchers. This vastly streamlines the
propagation code and allows us to easily switch to literals
in the next step.
This implementation watches _all_ solutions rather than using
the modern 2-watched literals scheme or the intermediate
head/tail watchers.
Ultimately a more effective watcher scheme would be interesting
but not a significant priority seeing as most of the solver runtime
is spent not in propagation but in problem translation.
decision trees
--------------
The new watchers produce slightly different decision trees, sometimes
subtly changing solutions. Notably in various observed examples in
Ubuntu 25.04, courier was installed as an MTA instead of postfix:
The old decision tree was:
apcupsd:amd64 -> mailutils:amd64=1:3.18-1 -> mailutils:amd64 -> postfix:amd64=3.9.1-10ubuntu1
The new decision tree is:
lsb:amd64 -> lsb-core:amd64 -> courier-mta:amd64=1.3.13-1
The difference here being that lsb-core declares a mail-transport-agent
dependency whereas mailutils depends on `default-mta | mail-transport-agency`;
but both are effectively subject to selection at similar time.
Further work is needed to optimize selection. A notable choice may also
be to deal with broken packages like lsb-core that declare dependencies
solely on a virtual package by reconstructing the default provider for
that package utilizing default-* dependencies or similar notions.
Likewise in the test suite, explanations are different in some
uninstallable cases.
backtracking
~~~~~~~~~~~~
The following major changes were observed in the 25.04 test suite:
-tmp/regression-remove/07f0a068-36c2-11f0-b7c1-fa163e171f02:18
+tmp/regression-remove/07f0a068-36c2-11f0-b7c1-fa163e171f02:3
-tmp/regression-remove/32078f70-3734-11f0-a75a-fa163ec8ca8c:64
+tmp/regression-remove/32078f70-3734-11f0-a75a-fa163ec8ca8c:19
Other test cases showed little deviation, +/- 1, generally
the same amount of backtracking.
performance
~~~~~~~~~~~
Running Ubuntu's regression test suite resulted in no significant
performance difference being observable.
Before: 290s user time; 16.66% solver
After: 299s user time; 17.36% solver
Tests where run with make -j 8 and solver performance extracted
perf report --symbol-filter=ResolveExternal --stdio
|
| | |
|
| |
|
|
| |
Quite a convenient way since we need exactly lifted bool semantics
|
| |
|
|
|
| |
We configure all variants the CPU supports as active, but repositories
usually do not provide all of them, so let's not be noisy.
|
| |
|
|
|
|
|
|
|
|
| |
Refactor code into a doOne helper lambda, and then add loop
over the providers to use it.
This fixes a crash seen by Benjamin in a nice way than just
failing :)
Reported-by: Benjamin Drung
|
| | |
|
| |
|
|
| |
Where applicable
|
| |
|
|
| |
I do not know why I don't hit this
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This method is no longer needed technically speaking, we should
use Assume() instead. It turns out that there is a slight bug in
the propagation and some clauses that are unit end up on the heap
rather than having been propagated away, so we temporarily need
to keep an if for that around.
To accomodate the switch from Push() to Assume() we need to make
sure that the work item is pushed to our trail *after* we
have assumed it, such that reverting pushes it back to the work
heap.
Refactor the code to consistently use Assume() rather than supporting
Enqueue(), this vastly simplifies things. This is not fully accurate
in the current model and leads to unnecessary decision levels, since
sometimes we seem to be reaching unit clauses here.
This preserves traversal order by first removing the item from the
heap and then adding it back if we need to solve it again.
|
| |
|
|
|
| |
This is like assert() but never compiled out so can be used with
function calls that have side effects.
|
| |
|
|
|
| |
We can just re-use Enqueue() here to produce our conflict
message why am I being silly and duplicate this.
|
| |
|
|
|
| |
Matches the rename of depth() to decisionLevel() at a shorter
name.
|
| |
|
|
|
|
|
| |
The previous use of decision here conflicted with the use
of decision level and the general notion of having made a
decision, because the assignment might have been propagated
as a matter of fact.
|
| |
|
|
|
| |
Move the DependencySolver methods and their helpers to the end of
the file.
|
| |
|
|
| |
Extract almost all dependency logic into a subclass
|
| |
|
|
|
|
|
| |
This removes the need for the forward references, thus fixing part
of the libc++ issues pointed out in [merge-511].
[merge-511] https://salsa.debian.org/apt-team/apt/-/merge_requests/511/diffs
|
| |
|
|
|
| |
This should make it easier for people with MiniSAT knowledge
to onboard themselves to the solver.
|
| |
|
|
|
| |
MUST becomes True, MUSTNOT becomes False, and NONE becomes
Undefined.
|
| | |
|
| |
|
|
| |
This simplifies the code _slightly_
|
| | |
|