| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
We inadvertently changed a CreateDynamicMMap call.
Fix that function instead.
Regression-of: 23dba65f031954df896bc3c6dfb1a9705574886b
|
| |
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
| |
When a provides was copied, we inadvertently copied the package
version instead of the provided version. Copy the provided version
instead.
Closes: #1120463
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Architecture variants are children of an architecture that share
the same ABI but are optimized for different ISA levels. They
are available in Ubuntu 25.10 and newer, and not supported in
Debian or other distributions.
A deb built for a variant contains the Architecture-Variant field,
and the Architecture field points to the baseline, for example:
Architecture: amd64
Architecture-Variant: amd64v3
However, the apt-get indextargets command reports the variant in the
Architecture: field, and most of the code in APT presents the variant
as the architecture.
There are two types of variants:
1. Standalone variants are recorded in the Architectures field of the
Release file as if they were a real architecture:
Architectures: amd64 amd64v3
Standalone architecture variants only fetch the standalone
architecture variant's Packages file. To do this, this patch
changes the code such that the variants indextargets "supplant"
the base targets.
This may have complicated outcomes on the apt-get indextargets
command.
2. Other variants can only be identified by their files being recorded
with hashes in the Release file.
APT fetches both the base architecture's as well as the variant's
Packages file.
Variants are configured in the
APT::Architecture-Variants
list.
Image builders may want to build specific variant images using
APT::Architecture-Variants { "amd64v3"; }
But this commit also implements an automatic discovery mechanism
using the varianttable and /proc/cpuinfo.
APT::Architecture-Variants "auto";
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
'Include' allows limiting a repository to a allowlist of packages,
'Exclude' allows removing packages from a repository.
Implementation wise this is not the nicest as it goes via the
IndexTarget options, so we first parse our option value into a
vector, then we turn the vector into a string, and then vectorize
it again. That said, we support both "," and " " as separators due
to the construction (we split by "," then we join using " ").
Gbp-Dch: full
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
VersionExtra holds, at runtime, the SHA256 of the packages being
added to try to avoid deduplicating obviously different packages;
the SHA256 itself is too large to store in the cache.
When volatile sources are used, the VersionExtra array is not
initialized, or rather it used to be initialized to 32*1024
zero elements as a performance optimization.
This meant that specifying --with-source with a package that
looks like a duplicate of a version with an ID >= 32*1024 triggered
the assertion; so we could not reproduce it easily in the test
suite.
Remove the optimized initialization to make the behavior more
uniform; and treat too large version IDs as having no SHA256.
Closes: #1098702
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This is the first step that introduces a 1:1 mapping between version
and source version. In a future version this can use the fields
currently marked unavailable to deduplicate the SourceVersion
objects across the group.
The policy gains a member for storing pins for sourceversions.
Together, in the future we should be able to determine candidates
for source versions.
|
| |
|
|
|
| |
main picked up a couple new ifdefs since the branch started; so
clean them up again.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Avoiding duplications is one thing, but it could also be handy to know
all sources for a description so that you can e.g. avoid opening another
file or similar such if its also present in one you already have open.
Given how the structures were set up this was probably intended all
along and either worked at some point or was abandoned for the
duplicates that we started culling heavily with the introduction of
MultiArch as at that point they blew up the cache and needed to be dealt
with.
|
| |
|
|
|
|
|
|
| |
The architectures are supposed to share the descriptions as they are
(very usually) the same, but the code was happily creating structs
for every architecture of a package which is especially pointless as
for e.g. Debian those will be the short description likely superseded
in output and all uses by the 'en' "translation".
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Same reason as with the description size before, but this one had
actually one extremely dated user in src:apt left with dumpavail,
which is changed to an implementation that is (in comparison) a bit
slower, but should be good enough for a command that is ideally not
used anymore (even if codesearch suggests otherwise).
After all, what makes this a bit slower is not that we don't know the
size, but that this one does additional work preparing for accessing
the fields which we don't do. In exchange pkgTagFile has a better
implementation for "Jitter" than the old code that we would "just"
need to copy here if speed were really an issue.
|
| |
|
|
|
|
|
|
|
|
|
| |
Nothing in src:apt uses this information and that isn't all to
surprising as it is usually not that interesting to know how big
a specific stanza of a description is as the max size is available
and you are usually working with more than one description.
So this information just takes up space in our binary cache…
64 bits per structure which can quickly add up to whole MBs
depending on how many (and which) sources you have enabled.
|
| |
|
|
| |
Fixes: 2c03eed649068c8838d971ceeb1a09603dcc8e9c
|
| |
|
|
| |
std::string_view
|
| | |
|
| |
|
|
|
|
|
| |
When -o Dir::Cache::pkgcache or -o Dir::Cache is set to /dev/null
we accidentally changed its mode to 0666; which is certainly not
intended. Avoid this issue by exiting the function early if the
file specified is /dev/null.
|
| |
|
|
|
|
| |
This was automated with sed and git-clang-format, and then I had to
fix up the top of policy.cc by hand as git-clang-format accidentally
indented it by two spaces.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoid copying the header from a stack allocated object as this
will copy uninitialized padding bytes into the cache, triggering
valgrind errors which people then use as a strawman for unrelated
errors on armhf.
In an optimal world we should annotate the allocator however such
that valgrind actually does treat those bytes as uninitialized and
then supress warnings in the harmless places, such that when you
then go and try to access it in a place that matters, you do get
an error for uninitialized memory.
Currently any access within the pool will be considered initialized
which is clearly suboptimal. But this is very much a TBD topic and
involves annotating the allocator everywhere.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
If we know both SHA256, and they're different, the packages are. This
approach stores the SHA256 only at runtime, avoiding the overhead of
storing it on-disk, because when we update repositories we update all
of them anyhow.
Note that pkgCacheGenerator is hidden, so we can just modify its
ABI, hooray.
Closes: #931175
LP: #2029268
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As we don't know which architectures we will deal with and to avoid
creating many "unneeded" packages (and provides) the cache
generation uses a scheme of on-demand creation (see ecc138f858).
This assumed a particular handling of :any which got changed later
(3addaba1ff) making this code path not only no longer needed for
M-A:allowed, but actually wrong as it would go on and create provides
for the explicit Provides of a package as if the package would be
M-A:foreign.
The result was that a package A:amd64 providing B tagged as M-A:allowed
would satisfy a "C:armel depends on B". Note that this bug does NOT
effect "C:armel depends on A" which is (correctly) not satisfied as
before.
References: ecc138f858, 3addaba1ff
|
| |
|
|
|
|
|
| |
Depending on your configured source 25 MB is hardly enough, so the mmap
housing the cache while it is build has to grow. Repeatedly. We can cut
down on the repeats of this by keeping a record of the size of the old
cache assuming the sizes will remain roughly in the same ballpark.
|
| |
|
|
|
|
|
|
|
| |
The undefined behaviour sanitizer complains with:
runtime error: addition of unsigned offset to 0x… overflowed to 0x…
Compilers and runtime do the right thing in any case and it is a
codepath that can (and ideally should) be avoided for speed reasons
alone, but fixing it can't hurt (too much).
|
| |
|
|
|
|
|
|
| |
Assigning the result of AllocateInMap directly to Ver->d caused Ver->d
to be resolved first, and hence if Ver was remapped during the
AllocateInMap, we were trying to assign to the old value.
Closes: #980037
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for Phased-Update-Percentage by pinning
upgrades that are not to be installed down to 1.
The output of policy has been changed to add the level of
phasing, and documentation has been improved to document
how phased updates work.
The patch detects if it is running in a chroot, and if so, always
includes phased updates, restoring classic apt behavior to avoid
behavioral changes on buildd chroots.
Various options are added to control this all:
* APT::Get::{Always,Never}-Include-Phased-Updates and their legacy
update-manager equivalents to always or never include phased updates
* APT::Machine-ID can be set to a UUID string to have all machines in a
fleet phase the same
* Dir::Etc::Machine-ID is weird in that it's default is sort of like
../machine-id, but not really, as ../machine-id would look up
$PWD/../machine-id and not relative to Dir::Etc; but it allows you to
override the path to machine-id (as opposed to the value)
* Dir::Bin::ischroot is the path to the ischroot(1) binary which is used
to detect whether we are running in a chroot.
|
| | |
|
| |
|
|
|
|
| |
When converting a long offset to a uint32_t to be stored in
the map, check that this is safe to do. If the offset is
negative, or we lose data in the conversion, we lost.
|
| |
|
|
|
|
|
|
|
|
|
| |
Instead of just using uint32_t, which would allow you to
assign e.g. a map_pointer<Version> to a map_pointer<Package>,
use our own smarter struct that has strict type checking.
We allow creating a map_pointer from a nullptr, and we allow
comparing map_pointer to nullptr, which also deals with comparisons
against 0 which are often used, as 0 will be implictly converted
to nullptr.
|
| | |
|
| |
|
|
|
|
| |
This is a first step to a type safe cache, adding typing
information everywhere. Next, we'll replace map_pointer<T>
implementation with a type safe one.
|
| | |
|
| |
|
|
|
|
|
| |
NewGroup created a GrpIterator and then called WriteStringInMap()
which might remap the cache, causing the iterator to go invalid.
Avoid this simply by creating the iterator later on.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
APT 1.9.6 introduced empty groups by making use of groups to
deduplicate package names. This is not normally a problem, but
here we assumed that every group has at least one package.
This caused a problem because automake was providing automake-1.16
while having the source package automake-1.16. So we found the
automake-1.16 group, iterated over its empty package list, trying
to store the provides (which hence never happened).
LP: #1859952
|
| |
|
|
| |
Remove it everywhere, except where it is still needed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We were de-duplicating package name strings in StoreString, but also
deduplicating most of them by them being in groups, so we had extra
hash table lookups that could be avoided in NewGroup().
To continue deduplicating names across binary packages and source
packages, insert groups for source packages as well. This is also
a good first step in allowing efficient lookup of packages by source
package - we can extend Group later by a list of SourceVersion objects,
or alternatively, simply add a by-source chain into pkgCache::Version.
This change improves performance by about 10% (913 to 814 ms), while
having no significant overhead on the cache size:
--- before
+++ after
@@ -1,7 +1,7 @@
-Total package names: 109536 (2.191 k)
-Total package structures: 118689 (4.748 k)
+Total package names: 119642 (2.393 k)
+Total package structures: 118687 (4.747 k)
Normal packages: 83309
- Pure virtual packages: 3365
+ Pure virtual packages: 3363
Single virtual packages: 17811
Mixed virtual packages: 1973
Missing: 12231
@@ -10,21 +10,21 @@ Total distinct descriptions: 149291 (3.583 k)
Total dependencies: 484135/156650 (12,2 M)
Total ver/file relations: 57421 (1.378 k)
Total Desc/File relations: 18219 (437 k)
-Total Provides mappings: 29963 (719 k)
+Total Provides mappings: 29959 (719 k)
Total globbed strings: 226993 (5.332 k)
Total slack space: 26,8 k
-Total space accounted for: 38,1 M
+Total space accounted for: 38,3 M
Total buckets in PkgHashTable: 50503
- Unused: 5727
- Used: 44776
- Utilization: 88.6601%
- Average entries: 2.65073
+ Unused: 5728
+ Used: 44775
+ Utilization: 88.6581%
+ Average entries: 2.65074
Longest: 60
Shortest: 1
Total buckets in GrpHashTable: 50503
- Unused: 5727
- Used: 44776
- Utilization: 88.6601%
- Average entries: 2.44631
- Longest: 10
+ Unused: 4649
+ Used: 45854
+ Utilization: 90.7946%
+ Average entries: 2.60919
+ Longest: 11
Shortest: 1
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
No user visible change expect for some years old changelog entries,
so we don't really need to add a new one for this…
Reported-By: codespell
Gbp-Dch: Ignore
|
| |
|
|
| |
Prompted-by: Jakub Wilk <jwilk@debian.org>
|
| |
|
|
|
| |
Reported-By: codespell & spellintian
Gbp-Dch: Ignore
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the cache needs to grow to make room to insert volatile files like
deb files into the cache we were remapping null-pointers making them
non-null-pointers in the process causing trouble later on.
Only the current Releasefile pointer can currently legally be a
nullpointer as volatile files have no release file they belong to, but
for safety the pointer to the current Packages file is equally guarded.
The option APT::Cache-Start can be used to workaround this problem.
Reported-By: Mattia Rizzolo on IRC
|
| |
|
|
|
|
|
|
|
|
| |
gcc was warning about ignored type qualifiers for all of them due to the
last 'const', so dropping that and converting to static_cast in the
process removes the here harmless warning to avoid hidden real issues in
them later on.
Reported-By: gcc
Gbp-Dch: Ignore
|
| |
|
|
|
|
|
|
|
|
| |
gcc has problems understanding this construct and additionally thinks it
would produce multiple lines and stuff, so to keep using it isn't really
worth it for the few instances we have: We can just write the long form
there which works better.
Reported-By: gcc
Gbp-Dch: Ignore
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This makes it easier to see which headers includes what.
The changes were done by running
git grep -l '#\s*include' \
| grep -E '.(cc|h)$' \
| xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/'
To modify all include lines by adding a space, and then running
./git-clang-format.sh.
|
| |
|
|
|
| |
Including cacheiterators.h before pkgcache.h fails because
pkgcache.h depends on cacheiterators.h.
|
| |
|
|
|
|
|
| |
Keeping the Fd of the cache file we have validated around to later load
it into the mmap ensures not only that we load the same file (which
wouldn't really be a problem in practice), but that this file also still
exists and wasn't deleted e.g. by a 'apt clean' call run in parallel.
|
| |
|
|
|
|
|
|
|
|
|
| |
Our profile says we spend about 5% of the time transforming the
hex digits into the binary format used by HashsumValue, all for
comparing them against the other strings. That makes no sense
at all.
According to callgrind, this reduces the overall instruction
count from 5,3 billion to 5 billion in my example, which
roughly matches the 5%.
|
| |
|
|
|
|
|
| |
This has the effect of significantly reducing actual string
comparisons, and should improve the performance of FindGrp
a bit, although it's hardly measureable (callgrind says it
uses 10% instructions less now).
|
| |
|
|
|
|
| |
As the volatile sources are parsed last they were sorted behind the
dpkg/status file and hence are treated as a downgrade, which isn't
really what you want to happen as from a user POV its an upgrade.
|
| |
|
|
|
|
|
|
|
|
|
| |
If an iterator or a stringview has multiple dynamic objects
registered with it, it may be remapped twice. Prevent that
by noting which iterators/views we have seen and not remapping
one if we have already seen it.
We most likely do not have any instance of multiple dynamics
on a single object, but let's play safe - the overhead is not
high.
|