summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* 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
* | | Don't venture too deeply in AutoRemovers MarkPackageDavid Kalnischkies2021-08-281-9/+16
| | | | | | | | | | | | | | | | | | MarkInstall has the same depth limit, so lets use this arbitrary limit to avoid trying to hard as that usually means we will never stop – at least not until we crash, which is not a very good error case.
* | | Move hidden MarkPackage to a static functionDavid Kalnischkies2021-08-282-113/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't have external users as its marked hidden and as we don't even have users outside of pkgDepCache itself we can remove the function completely from the public eye. That adds many new parameters, but it also allows to add a few more like avoiding constantly checking the debug config value. Gbp-Dch: Ignore
* | | Simplify selection of highest source version providersDavid Kalnischkies2021-08-281-6/+3
|/ / | | | | | | | | | | | | | | | | The old code is a bit longer and does a sort (N*log(N)) + find (at most N) It is replaced by max_element (N) + remove_if (N). The practical difference is minimal as the N we operate on is rather small, but the replacement is hopefully easier to understand at a glance as well. Gbp-Dch: Ignore
* | Add support for a maximum delay and testing of delayJulian Andres Klode2021-07-281-1/+4
| | | | | | | | | | | | This is very basic support on the testing side, we just test the debug output but not how long it actually took. Would be nice to check time really.
* | Properly convert PulseInterval to timevalJulian Andres Klode2021-07-281-6/+3
| | | | | | | | | | Fix the typo, and use the helper function to convert it, so we do not end up with 5 seconds encoded as 0s and 5*10^6 microseconds.
* | Convert to monotonic clockJulian Andres Klode2021-07-285-22/+33
| | | | | | | | | | This yields more accurate delays and avoids issues with clock skew.
* | acquire: Automatically reduce select() timeout as neededJulian Andres Klode2021-07-281-1/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is an item with fetchAfter at the top of a queue, reduce sleep() timeout so we can detect it and start it, by calling Cycle() on the queue in the next iteration. For some reasons we have to call select() with a 0s timeout if we just marked an item as ready. Oh well. Previous versions of this patch only called global Bump() after a timeout from select(); this was unfortunately incorrect - it meant that we never bumped a queue that did not start yet while other queues were running, potentially significantly delaying retries.
* | Implement exponential delay between retriesJulian Andres Klode2021-07-285-3/+48
| | | | | | | | | | | | | | Add a new Item field called FetchAfter, which determines the earliest time the item should be fetched at. Adjust insertion into queue to take it into account alongside priority, and only fill pipelines with items that are ready.
* | pkgAcqIndex::CommonFailed: Set StatIdle before calling Init()Julian Andres Klode2021-07-131-1/+1
| | | | | | | | | | | | | | | | Enqueuing by calling Init(), and then resetting the status to idle means that the item can get enqueued twice if we call Cycle() from inside pkgAcquire::Run(). Reset the status to StatIdle before calling Init()
* | Merge branch 'fix/dpkgchroot' into 'main'Julian Andres Klode2021-07-053-30/+26
|\ \ | | | | | | | | | | | | Restore dpkg::chroot-directory functionality See merge request apt-team/apt!178
| * | Restore dpkg::chroot-directory functionalityDavid Kalnischkies2021-06-103-30/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we call dpkg inside a chroot we have to ensure that the temporary directory we construct to call dpkg --recursive is inside the chroot and that we strip the path to the chroot from the directory name we pass to dpkg. Note that the added test succeeds before and (hopefully) after as we can't really chroot here or fiddle with the needed settings as we are already setting up apt to work with a quasi-chroot. The test perhaps helps in ensuring we don't break it too much in the future though. (Broken five years (and one day) ago this seems to have an immense user base at the moment, but it might in the future via mmdebstrap) References: f495992428a396e0f98886c9a761a804aa161c68 Reported-By: Johannes Schauer Marin Rodrigues on IRC Tested-By: Johannes Schauer Marin Rodrigues
* | | Store size from volatile sources for already installed versionsDavid Kalnischkies2021-06-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Volatile sources are parsed after the status file, so if we have a version already installed the size information is not stored, so that a reinstall of said version is refused claiming a broken repository. References: 1412cf51403286e9c040f9f86fd4d8306e62aff2
* | | Use full item description in broken repo errorDavid Kalnischkies2021-06-101-3/+2
|/ / | | | | | | | | | | | | | | The error says the repository is broken but doesn't mention which one it is. The item description gives us at least all the information, but is not as nicely formatted. As this message is not even marked for translation this is a rather temporary affair and we can survive without the eye candy for a while.
* | No URL decode and quoting support for Files in SourcesDavid Kalnischkies2021-06-041-16/+14
| | | | | | | | | | | | | | | | The code exists since ever, but no other client supports this and the specification like debian-policy isn't asking for this either. What it does do is breaking than all others continue working through: If the filename includes in fact URI encoded bits (hopefully no quotes) which is rather unlikely, but none the less possible.
* | URI encode Filename field of Packages files (again)David Kalnischkies2021-06-042-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Keeping URIs encoded in the acquire system depends on having them encoded in the first place. While many other places got the encoding 2 out of 3 ArchiveURI implementations were missed which are in practice responsible for nearly all of the URI building, just that index filename do not contain characters to escape and the Filename fields in Packages files usually aren't. Usually. Except if you happen to have e.g. an epoch featuring package with the colon encoded in the filename. On the upside, in most repositories the epoch isn't part of the filename. Reported-By: Johannes 'josch' Schauer on IRC References: e6c55283d235aa9404395d30f2db891f36995c49
* | policy: Apply phasing to uninstalled packages tooJulian Andres Klode2021-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a package is not installed yet, we do need to apply phasing as we otherwise get into weird situations when installing packages: In the launchpad bug below, ubuntu-release-upgrader-core was installed, and hence the phasing for the upgrade to it was applied. However, ubuntu-release-upgrader-gtk was about to be installed - and hence the phasing did not apply, causing a version mismatch, because ubuntu-release-upgrader-gtk from -updates was used, but -core from release pocket. Sigh. An alternative approach to dealing with this issue could be to apply phasing to all packages within the same source package, which would work in most cases. However, there might be unforeseen side effects and it is of course possible to have = depends between source packages, such as -signed packages on the unsigned ones for bootloaders. This problem does not occur in the update-manager implementation of phased updates as update-manager only deals with upgrading packages, but does not install new packages and thus does not see that issue. APT however, has to apply phasing more broadly, as you can and often do install additional packages during upgrade, or upgrade packages during install commands, as both accept package list arguments and have the same code in the backend. LP: #1925745