summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* Use temporary file instead of depending on /dev/stdin for triehashDavid Kalnischkies2022-05-111-2/+3
| | | | | | | | /dev might not be populated for example in unshare chroots, so just using a temporary file it is until triehash supports non-file input. Regression-Of: f6438ea9e726a1c13ce8d90ac78cc272346ab0f8 Gbp-Dch: Ignore
* Include our config.h in all C++ files to avoid ODR violationsDavid Kalnischkies2022-05-073-0/+6
| | | | | | | Some of our headers use APT_COMPILING_APT trickery to avoid exposing too broadly details we don't want external clients to know and make use of. The flip-side is that this can lead to different compilation units seeing different definitions if they aren't all using the same config.
* Remove unused public zlib include from libapt fileutl.hDavid Kalnischkies2022-05-071-3/+0
| | | | | | | | Our public interface doesn't use zlib for quite a while now so lets drop the last remnants as hopefully nobody depends on us bringing it in… Unlike our own private lib for transitive provision of unistd.h. References: 680b916ce7203a40ebd0a3882b9a71ca77278a67
* Merge branch 'fix/tagfilekeys' into 'main'Julian Andres Klode2022-05-0620-145/+161
|\ | | | | | | | | Consistently dealing with fields via pkgTagSection::Key See merge request apt-team/apt!233
| * Parse Checksum fields via pkgTagSection::Key, tooDavid Kalnischkies2022-04-015-31/+40
| | | | | | | | | | | | | | We abstract hashes a fair bit to be able to add new ones eventually, which lead us to building the field names on the fly. We can do better through by keeping a central place for these names, too, which even helps in reducing code as we don't need the MD5 → Files dance anymore.
| * Use pkgTagSection::Key in more places in src:aptDavid Kalnischkies2022-04-018-48/+55
| | | | | | | | | | | | | | | | | | | | The speed critical paths were converted earlier, but the remaining could benefit a tiny bit from this as well especially as we have the facility now available and can therefore brush up the code in various places in the process as well. Also takes the time to add the hidden Exists method advertised in the headers, but previously not implemented.
| * Avoid .c_str() on strings feed into pkgTagSection::FindSDavid Kalnischkies2022-04-014-13/+13
| | | | | | | | | | | | FindS has a APT::StringView based API nowadays, so we can avoid these explicit calls also allowing us to avoid the std::string in input or output entirely or at least move it a few branches down.
| * Stop parsing undocumented unknown EDSP field APT-HashDavid Kalnischkies2022-04-011-3/+1
| | | | | | | | | | | | | | It was introduced in the first commit for EDSP, but beside this reference, never appears in documentation and code. Seems like an earlier name of what APT-ID ended up to be and as such should be more than safely being able to retire now.
| * Do not order long obsoleted fields anymoreDavid Kalnischkies2022-04-011-7/+7
| | | | | | | | | | | | The dependency relation fields old names were deprecated in 1995 as the new ones were introduced. That seems barely long enough now as a transition period.
| * Drop support for long obsoleted Suggests alias: OptionalDavid Kalnischkies2022-04-013-6/+2
| | | | | | | | | | dpkg-dev stopped recognizing it in 2007 (1.14.7) while building packages. The rename itself happened in 1995 (0.93.72).
| * Document tagfile-keys.h as internal to aptDavid Kalnischkies2022-04-016-45/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous regime of the file was to sort it on insert, but that changes the values in the generated enum, which is fine as long as we only use it in libapt itself, but breaks on other users. The header was always intended to be private to apt itself, so we just document this here now and lay the ground work to have the file in the future only appended to, so that it remains sufficiently ABI stable that we can use it outside the library in our apt tools. We also remove some fields apt is unlikely to need or only uses in certain cases outside of any (speed) critical path to have enough room to add more fields soon as currently we are limited to 128 fields max and it would be sad if we use up that allowance entirely already.
* | Merge branch 'pu/gcc-12' into 'main'Julian Andres Klode2022-05-062-3/+12
|\ \ | | | | | | | | | | | | Avoid use of deprecated std::iterator (twice) See merge request apt-team/apt!232
| * | Avoid use of deprecated std::iterator (twice)Helmut Grohne2022-03-212-3/+12
| | | | | | | | | | | | Closes: #1008036
* | | Only protect two kernels, not last installed oneJulian Andres Klode2022-04-071-14/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | The kernel autoremoval algorithm was written to accomodate for Ubuntu's boot partition sizing, which was written to accomodate 3 kernels - 2 installed ones + a new one being unpacked. It seems that when the algorithm was designed, it was overlooked that it actually kept 3 kernels. LP: #1968154
* | Recognize Static-Built-Using and order it below Built-UsingDavid Kalnischkies2022-04-012-0/+2
|/ | | | | | | | | dpkg added a new field (see there for details) which breaks our testcases due to an unknown field. apt doesn't make use of the field, but we can at least order it nicely in output we generate. References: dpkg commit 16c412439c5eac5f32930946df9006dfc13efc02 Closes: #1008759
* Avoid using unqualified make_pair potentially triggering ftbfsDavid Kalnischkies2022-03-211-1/+1
| | | | | | | | If the includes are slightly changed, we end with an error here: apt/apt-pkg/depcache.cc:2059:31: error: ‘make_pair’ was not declared in this scope; did you mean ‘std::make_pair’? Yes, we mean std::make_pair, but we can avoid the explicit call altogether by using emplace_back instead of push_back.
* Fix incorrect type when parsing Size (int to unsigned long long)Arnaud Rebillout2022-01-201-1/+1
| | | | | | | | | | Should have been done in 650faab016 (2011). At this time, the type of the Size parameter in the function prototype was changed to unsigned long long, however FindI was NOT changed to FindULL: git diff 650faab016^..650faab016 -- apt-pkg/indexcopy.cc Closes: #1004064
* Introduce and use isalpha_ascii() in debversion rather than isalpha()Julian Andres Klode2022-01-062-1/+16
| | | | | Avoid misclassifying additional alphabetical characters from certain locales as alpha and then sort them by ASCII...
* Merge branch 'main' into 'main'Julian Andres Klode2022-01-062-10/+32
|\ | | | | | | | | Fix incorrect SIGWINCH handling See merge request apt-team/apt!204
| * Fix incorrect SIGWINCH handlingZhang Boyang2021-12-192-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, status line is redrawn in signal handler. However, the drawing code make heavy use of std::string and other syscalls, which may not be async-signal-safe. This will cause deadlock, overwritten errno, even silent memory corruption. This patch implemented Anders Kaseorg's idea. The signal handler will only set a flag, which is async-signal-safe, and actual redrawing will be deferred to PackageManagerFancy::Pulse(). Note that the virtual function PackageManagerFancy::Pulse() already exists in base class but newly overridden in PackageManagerFancy, so the ABI compatibility should be OK. However, existing compiled programs may not aware of this new function and continue to use old Pulse() if compiler had done heavy optimization. Fortunately this is not too harmful because this will only cause status line not redrawing, which may consider acceptable. Closes: #852757
* | Merge branch 'spelling' into 'main'Julian Andres Klode2022-01-059-34/+34
|\ \ | | | | | | | | | | | | Spelling fixes See merge request apt-team/apt!194
| * | Spelling fixesVille Skyttä2021-11-279-34/+34
| |/
* / add pattern to select packages by codename (closes: #1002646)Johannes Schauer Marin Rodrigues2021-12-262-0/+17
|/
* Support more than exact release matches in 'source'David Kalnischkies2021-11-232-42/+59
| | | | | | | | | | | | | | | | | The Debian 11 release notes elevate matching with regex to a documented and much used feature, which it previously wasn't. For binary packages this is not a problem, but source packages are special and it turns out that matching by release is here an exact string match only. A bit of refactoring later we can reuse the code we use for Packages files also for Release files, which is what we have for Sources files as those files itself have no representation in the cache. This means that we do not support matching based on components (c=main) in source, but we didn't before and we can cross that bridge if anyone notices… Closes: #998444
* apt-pkg/contrib/srvrec.h: Explicitly include sys/types.hAlexander Kanavin2021-11-221-0/+1
| | | | This avoids type errors with musl C library.
* Merge branch 'pu/essential-removal' into 'main'Julian Andres Klode2021-11-171-0/+18
|\ | | | | | | | | Do not remove Essential/Protected due to dependencies See merge request apt-team/apt!198
| * Do not remove Essential/Protected due to dependenciesJulian Andres Klode2021-11-171-0/+18
| | | | | | | | | | | | | | | | Suggesting the removal of Essential and Protected packages as a solution leads to situations where YouTubers end up removing their desktop. Let's not remove such packages ourselves.
* | Don't print every inline PGP key in Signed-ByVictor Westerhuis2021-11-051-1/+0
|/ | | | It looks like a debug line was left in accidentally.
* Invalidate cached architecture list when building cacheJulian Andres Klode2021-10-192-1/+5
| | | | | | | | Fix a regression in python-apt where switching the architectures in the config between cache invocations regressed. Regression-Of: 8ff4e226af55a9feb168477a2b1a99f9c5152e54 Gbp-Dch: full
* Merge branch 'feature/install-versioned-provides' into 'main'Julian Andres Klode2021-10-193-24/+66
|\ | | | | | | | | Allow =version and /release selectors on virtual packages See merge request apt-team/apt!121
| * Allow =version and /release selector on virtual packagesDavid Kalnischkies2020-05-272-17/+58
| | | | | | | | | | | | | | | | | | | | | | We already have code for figuring out if a virtual package is only provided by a single provider (and otherwise show a list) we can auto-select for the user, so we can adapt that to work with versioned provides as well and while at it also release selectors. The code tries to keep ABI backward compatible and hence turns relatively ugly as we need a parameter (the selector) to be passed around without adding a parameter or new virtual methods.
| * Allow version selection to match versioned self-providesDavid Kalnischkies2020-05-271-7/+8
| | | | | | | | | | Edgecase of an edgecase at best, but it works just fine as a dependency, so it should really work on the commandline as well.
* | Merge branch 'fakechroot' into 'main'Julian Andres Klode2021-10-191-2/+12
|\ \ | | | | | | | | | | | | apt-pkg/deb/dpkgpm.cc: make DPkg::Chroot-Directory work under fakechroot See merge request apt-team/apt!189
| * | apt-pkg/deb/dpkgpm.cc: make DPkg::Chroot-Directory work under fakechrootJohannes Schauer Marin Rodrigues2021-09-191-2/+12
| | |
* | | Only allow full Signed-By keys where filenames are allowedJulian Andres Klode2021-10-181-3/+5
| | | | | | | | | | | | | | | | | | Rename the argument to Introducer and generalize it to anything that introduces new keys into the trusted vector, like file names and full keys.
* | | Add support for embedding PGP keys into Signed-By in deb822 sourcesJulian Andres Klode2021-10-181-0/+17
| | | | | | | | | | | | | | | | | | Extend the Signed-By field to handle embedded public key blocks, this allows shipping self-contained .sources files, making it substantially easier to provide third party repositories.
* | | acquire-item: Quote Signed-By before sending itJulian Andres Klode2021-10-181-2/+2
| | | | | | | | | | | | | | | | | | This currently has no effect, as there are no quotable characters inside it, but it will allow us to send embedded keys through to the method.
* | | Merge branch 'fix/file-https-proxy' into 'main'Julian Andres Klode2021-10-181-5/+5
|\ \ \ | | | | | | | | | | | | | | | | Fix file:/// vs file:/ hang & https-proxy for http See merge request apt-team/apt!187
| * | | Read and work with canonical file-URIs from sources.listsDavid Kalnischkies2021-09-131-5/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We allow file (and other file-based methods) URIs to either be given as file:///path or as file:/path, but in various places of the acquire system we perform string comparisons on URIs which do not handle this expecting the canonical representation produced by our URI code. That used to be hidden by us quoting and dequoting the URIs in the system, but as we don't do this anymore we have to be a bit more careful on input. Ideally we would do less of these comparisons, but for now lets be content with inserting a canonicalisation early on to prevent hangs in the acquire system.
* | | Merge branch 'bug-989558' into 'main'Julian Andres Klode2021-10-182-0/+19
|\ \ \ | | | | | | | | | | | | | | | | add pattern to select packages by priority (closes: #989558) See merge request apt-team/apt!185
| * | | add pattern to select packages by priority (closes: #989558)Johannes Schauer Marin Rodrigues2021-10-042-0/+19
| | | |
* | | | Merge branch 'feature/barbarianarchs' into 'main'Julian Andres Klode2021-10-187-52/+67
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | Streamline access to barbarian architecture functionality See merge request apt-team/apt!184
| * | | Streamline access to barbarian architecture functionalityDavid Kalnischkies2021-09-043-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | APT is not the place this information should be stored at, but it is a good place to experiment and see what will be (not) needed in the future for a proper implementation higher up the stack. This is why "BarbarianArchitectures" is chosen instead of a more neutral and/or sensible "VeryForeign" and isn't readily exported in the API to other clients for this PoC as a to be drawn up standard will likely require potentially incompatible changes. Having a then outdated and slightly different implementation block a "good" name would be bad. The functionality itself mostly exists (ignoring bugs) since the introduction of MultiArch as we always had the risk of encountering packages of architectures not known to dpkg (forced onto the system, potentially before MultiArch) we had to deal with somehow and other edge cases. All this commit really does is allowing what could previously only be achieved with editing sources.list and some conf options via a single config option: -o APT::BarbarianArchitectures=foo,bar
| * | | Barbarian M-A:allowed don't satisfy :any deps of other archsDavid Kalnischkies2021-09-041-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What does a M-A:allowed package from non-native/non-foreign architecture provide? If we look at M-A:foreign, such a package satisfies dependencies within its own architecture, but not in other architectures, so the same should apply to :any dependencies on M-A:allowed packages, but we have a problem: While unqualified package names are architecture-specific, the virtual package name qualified with :any is not (see 3addaba1ff). We could of course make it architecture-specific now, but that would introduce many virtual packages for this relatively minor usecase and would reintroduce a need for special display handling. So, we pull a trick here: Barbarian M-A:allowed packages do not provide the architecture-independent :any package anymore, but only a specific one and every :any dependency from a barbarian package is rewritten to an or-group of the specific and the independent :any package. References: 3addaba1ff
| * | | Do not make provides of M-A:allowed implicit M-A:foreignDavid Kalnischkies2021-09-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Refactor architecture handling in EDSP/EIPP codeDavid Kalnischkies2021-09-041-20/+18
| | | | | | | | | | | | | | | | | | | | | | | | This just moves code around without actually changing anything. Gbp-Dch: Ignore
| * | | All pkgCaches are MultiArch cachesDavid Kalnischkies2021-09-042-5/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2015 the code inside libapt who was using this field was dropped as even if we are on a system which is not configured for MultiArch, there are still edge cases in which the cache can include very foreign packages, so any assumption you could make thinking only a single architecture will be in the cache is probably wrong. Maintaining two different codepaths for Multi- and SingleArch is likely not very beneficial for code and users alike and is surprisingly hard to answer correctly and becoming even harder still, so always assuming the "worst case" seems like the far better option. References: 6c9937da76b9155d166092b9dda22d06200510c1
* | | Improve error handling of cycling delayed queuesJulian Andres Klode2021-09-061-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | When an item has been delayed and the queue is cycled to start it, we did not properly report an error from the cycling, and we would then fail in the assert(), causing all errors to be lost. Propagate the error instead and make the assert a warning.
* | | Increase recursion limits from 100 to 3000David Kalnischkies2021-08-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you install dpkg on an empty status file with all recommends and suggests apt wants to install 4000+ packages. The deepest chain seemingly being 236 steps long. And dpkg isn't even the worst (~259). That is a problem as libapt has a hardcoded recursion limit for MarkInstall and friends … set to 100. We are saved by the fact that chains without suggests are much shorter (dpkg has 5, max seems ~43), but I ignored Conflicts in these chains, which typically trigger upgrades, so if two of the worst are chained together we suddenly get dangerously close to the limit still. So, lets just increase the limit into oblivion as it is really just a safety measure we should not be running into to begin with. MarkPackage was running years without it after all. 3000 is picked as a nice number as any other and because it is roughly the half of the stack crashs I saw previously in this branch.
* | | Stop autoremover from endlessly exploring cyclic providersDavid Kalnischkies2021-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fullyExplored is needed to keep track of having explored all providers of a package name, while Marked is tracking if we have explored a given real package (along its chosen version), so we should stop MarkPackage from exploring a (real) package if it is marked and let fullyExplored only guard the looping over the individual dependencies. The testcase is deceptively simple, but in practice only an ecosystem like rust who makes heavy use of cyclic dependency relations intermixed with versioned provides actually triggers this as seen by the buggy code being in use for four months in Debian and Ubuntu development releases. (easier to trigger if most packages are marked manual installed) Note that the testcase is successful already due to the earlier changes as we exit the recursion eventually and all packages are marked as they need to be already, but this fix does work standalone as well. Closes: #992993