summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* Fix various typos reported by spellcheckersDavid Kalnischkies2018-05-0512-18/+18
| | | | | Reported-By: codespell & spellintian Gbp-Dch: Ignore
* Avoid implicitly promotion of float to doubleDavid Kalnischkies2018-05-052-2/+2
| | | | | Reported-By: gcc -Wdouble-promotion Gbp-Dch: Ignore
* CMake: Fix builds without zstdJulian Andres Klode2018-04-201-2/+2
| | | | Only use zstd defined variables if zstd was found.
* Merge branch 'pu/zstd' into 'master'Julian Andres Klode2018-04-154-2/+244
|\ | | | | | | | | pu/zstd See merge request apt-team/apt!8
| * zstd: Implement support for multi-frame filesJulian Andres Klode2018-04-131-4/+12
| | | | | | | | | | | | This implements support for multi frame files while keeping error checking for unexpected EOF working correctly. Files with multiple frames are generated by pzstd, for example.
| * Implement compression level handling for zstdJulian Andres Klode2018-04-131-1/+18
| | | | | | | | | | This is a simplified variant of the code for xz, adapted to support multiple digit integers.
| * apt-pkg: Add support for zstdJulian Andres Klode2018-03-124-2/+219
| | | | | | | | | | | | | | zstd is a compression algorithm developed by facebook. At level 19, it is about 6% worse in size than xz -6, but decompression is multiple times faster, saving about 40% install time, especially with eatmydata on cloud instances.
* | fix communication typo in https manpageDavid Kalnischkies2018-04-071-1/+1
| | | | | | | | Reported-By: lintian spelling-error-in-manpage
* | Bump cache major version to allow different 1.5 and 1.6 updatesJulian Andres Klode2018-03-191-1/+1
| | | | | | | | | | | | Shipping 1.6 with major 12 would not allow us to update 1.5.y in a different way than 1.6.y if we have to without resorting to minor version hacks. Let's just bump the major instead.
* | Use https for Ubuntu changelogsJulian Andres Klode2018-03-151-1/+1
|/ | | | We just enabled https on changelogs.ubuntu.com, let's use it.
* Merge branch 'pu/not-valid-before' into 'master'Julian Andres Klode2018-02-196-43/+126
|\ | | | | | | | | Check that Date of Release file is not in the future See merge request apt-team/apt!3
| * Check that Date of Release file is not in the futureJulian Andres Klode2018-02-196-43/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | By restricting the Date field to be in the past, an attacker cannot just create a repository from the future that would be accepted as a valid update for a repository. This check can be disabled by Acquire::Check-Date set to false. This will also disable Check-Valid-Until and any future date related checking, if any - the option means: "my computers date cannot be trusted." Modify the tests to allow repositories to be up to 10 hours in the future, so we can keep using hours there to simulate time changes.
* | ensure correct file permissions for auxfilesDavid Kalnischkies2018-02-192-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The interesting takeaway here is perhaps that 'chmod +w' is effected by the umask – obvious in hindsight of course. The usual setup helps with hiding that applying that recursively on all directories (and files) isn't correct. Ensuring files will not be stored with the wrong permissions even if in strange umask contexts is trivial in comparison. Fixing the test also highlighted that it wasn't bulletproof as apt will automatically fix the permissions of the directories it works with, so for this test we actually need to introduce a shortcut in the code. Reported-By: Ubuntu autopkgtest CI
* | indexcopy: Copy uncompressed indices from cdrom againJulian Andres Klode2018-02-191-2/+2
|/ | | | | | | | | This was broken by a refactoring in 1adcf56bec7d2127d83aa423916639740fe8e586 which iterated over getCompressorExtensions() instead of the compressors and using their extension field. getCompressorExtensions() does not contain the empty extension for uncompressed files, though, and hence this was broken. LP: #1746807
* allow the apt/lists/auxfiles/ directory to be missingDavid Kalnischkies2018-01-192-18/+36
| | | | | | | | | | apt 1.6~alpha6 introduced aux requests to revamp the implementation of a-t-mirror. This already included the potential of running as non-root, but the detection wasn't complete resulting in errors or could produce spurious warnings along the way if the directory didn't exist yet. References: ef9677831f62a1554a888ebc7b162517d7881116 Closes: 887624
* Introduce inrelease-path option for sources.listJulian Andres Klode2018-01-174-5/+29
| | | | | | | | | | | | | | Allow specifying an alternative path to the InRelease file, so you can have multiple versions of a repository, for example. Enabling this option disables fallback to Release and Release.gpg, so setting it to InRelease can be used to ensure that only that will be tried. We add two test cases: One for checking that it works, and another for checking that the fallback does not happen. Closes: #886745
* dpkg status parsing: check if name is valid before useDavid Kalnischkies2018-01-051-2/+17
| | | | | | | | The summary line sounds a bit much: what we end up doing is just adding two more guards before using results which should always be valid™. That these values aren't valid is likely a bug in itself somewhere, but that is no reason for crashing.
* simplify translating "lists directory missing" msgDavid Kalnischkies2018-01-042-7/+7
| | | | | | | | The appended "partial" should not be translated, but some translations got this wrong and now that there is also "auxfiles" we can just fix that problem by hiding these untranslatables from the translators. Gbp-Dch: Ignore
* require methods to request AuxRequest capability at startupDavid Kalnischkies2018-01-036-56/+106
| | | | | | Allowing a method to request work from other methods is a powerful capability which could be misused or exploited, so to slightly limited the surface let method opt-in into this capability on startup.
* reimplement and simplify mirror:// methodDavid Kalnischkies2018-01-031-19/+6
| | | | | | | | | | Embedding an entire acquire stack and HTTP logic in the mirror method made it rather heavy weight and fragile. This reimplement goes the other way by doing only the bare minimum in the method itself and instead redirect the actual download of files to their proper methods. The reimplementation drops the (in the real world) unused query-string feature as it isn't really implementable in the new architecture.
* allow a method to request auxiliary filesDavid Kalnischkies2018-01-037-22/+229
| | | | | | | | | | | | | | | | | | | | If a method needs a file to operate like e.g. mirror needs to get a list of mirrors before it can redirect the the actual requests to them. That could easily be solved by moving the logic into libapt directly, but by allowing a method to request other methods to do something we can keep this logic contained in the method and allow e.g. also methods which perform binary patching or similar things. Previously they would need to implement their own acquire system inside the existing one which in all likelyhood will not support the same features and methods nor operate with similar security compared to what we have already running 'above' the requesting method. That said, to avoid methods producing conflicts with "proper" files we are downloading a new directory is introduced to keep the auxiliary files in. [The message magic number 351 is a tribute to the german Grundgesetz article 35 paragraph 1 which defines that all authorities of the state(s) help each other on request.]
* refactor message generation for methodsDavid Kalnischkies2018-01-032-90/+102
| | | | | | The format isn't too hard to get right, but it gets funny with multiline fields (which we don't really have yet) and its just easier to deal with it once and for all which can be reused for more messages later.
* Support cleartext signed InRelease files with CRLF line endingsDavid Kalnischkies2018-01-021-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 89c4c588b275 ("fix from David Kalnischkies for the InRelease gpg verification code (LP: #784473)") amended verification of cleartext signatures by a check whether the file to be verified actually starts with "-----BEGIN PGP SIGNATURE-----\n". However cleartext signed InRelease files have been found in the wild which use \r\n as line ending for this armor header line, presumably generated by a Windows PGP client. Such files are incorrectly deemed unsigned and result in the following (misleading) error: Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?) RFC 4880 specifies in 6.2 Forming ASCII Armor: That is to say, there is always a line ending preceding the starting five dashes, and following the ending five dashes. The header lines, therefore, MUST start at the beginning of a line, and MUST NOT have text other than whitespace following them on the same line. RFC 4880 does not seem to specify whether LF or CRLF is used as line ending for armor headers, but CR is generally considered whitespace (e.g. "man perlrecharclass"), hence using CRLF is legal even under the assumption that LF must be used. SplitClearSignedFile() is stripping whitespace (including CR) on lineend already before matching the string, so StartsWithGPGClearTextSignature() is adapted to use the same ignoring. As the earlier method is responsible for what apt will end up actually parsing nowadays as signed/unsigned this change has no implications for security. Thanks: Lukas Wunner for detailed report & initial patch! References: 89c4c588b275d098af33f36eeddea6fd75068342 Closes: 884922
* do not remap current files if nullptrs in cache generationDavid Kalnischkies2017-12-241-10/+11
| | | | | | | | | | | | | | 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
* remove pointless APT_PURE from void functionsDavid Kalnischkies2017-12-148-22/+22
| | | | | | | | | | | Earlier gcc versions used to complain that you should add them althrough there isn't a lot of point to it if you think about it, but now gcc (>= 8) complains about the attribute being present. warning: ‘pure’ attribute on function returning ‘void’ [-Wattributes] Reported-By: gcc -Wattributes Gbp-Dch: Ignore
* implement fallback to alternative URIs for all itemsDavid Kalnischkies2017-12-135-159/+211
| | | | | | | | For deb files we always supported falling back from one server to the other if one failed to download the deb, but that was hardwired in the handling of this specific item. Moving this alongside the retry infrastructure we can implement it for all items and allow methods to use this as well by providing additional URIs in a redirect.
* give the methods more metadata about the files to acquireDavid Kalnischkies2017-12-133-12/+49
| | | | | | | | We have quite a bit of metadata available for the files we acquire, but the methods weren't told about it and got just the URI. That is indeed fine for most, but to avoid methods trying to parse the metadata out of the provided URIs (and fail horribly in edgecases) we can just as well be nice and tell them stuff directly.
* implement Acquire::Retries support for all itemsDavid Kalnischkies2017-12-133-49/+56
| | | | | | | Moving the Retry-implementation from individual items to the worker implementation not only gives every file retry capability instead of just a selected few but also avoids needing to implement it in each item (incorrectly).
* support multiline values in LookupTagDavid Kalnischkies2017-12-131-23/+69
| | | | | | | | | | LookupTag is a little helper to deal with rfc822-style strings we use in apt e.g. to pass acquire messages around for cases in which our usual rfc822 parser is too heavy. All the fields it had to deal with so far were single line, but if they aren't it should really produce the right output and not just return the first line. Error messages are a prime candidate for becoming multiline as at the moment they are stripped of potential newlines due to the previous insufficiency of LookupTag.
* deal with floats without old-style castDavid Kalnischkies2017-12-133-12/+14
| | | | | | | | We have no speed problem with handling floats/doubles in our progress handling, but that shouldn't prevent us from cleaning up the handling slightly to avoid unclean casting to ints. Reported-By: gcc -Wdouble-promotion -Wold-style-cast
* avoid some useless casts reported by -Wuseless-castDavid Kalnischkies2017-12-133-28/+22
| | | | | | | | | The casts are useless, but the reports show some where we can actually improve the code by replacing them with better alternatives like converting whatever int type into a string instead of casting to a specific one which might in the future be too small. Reported-By: gcc -Wuseless-cast
* convert various c-style casts to C++-styleDavid Kalnischkies2017-12-139-26/+28
| | | | | | | | | | 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
* deprecate the single-line deprecation ignoring macroDavid Kalnischkies2017-12-135-5/+16
| | | | | | | | | | 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
* fix over-calculating dpkg commandline lengthDavid Kalnischkies2017-12-131-0/+2
| | | | | | | | | Mostly harmless as it just means that apt thinks that the dpkg commandline it is building is slightly longer than it actually is and we have various ways of avoiding generating very long lines nowadays, but calculating the right value can't hurt. Reported-By: gcc -Wmultistatement-macros
* explicitly name token in auth.conf parsing errorDavid Kalnischkies2017-12-131-2/+12
| | | | Reported-By: gcc -Wsign-promo
* don't auto-switch candidate if installed is good enoughDavid Kalnischkies2017-12-131-0/+7
| | | | | | | If we perform candidate switching in requests like "apt install foo/bar" we should first check if the dependencies of foo from release bar are already satisfied by what is already installed before checking if the candidate (or switched candidate) would.
* if insecure repo is allowed continue on all http errorsDavid Kalnischkies2017-12-131-5/+14
| | | | | | | | | | | | | | | | | If a InRelease file fails to download with a non-404 error we assumed there is some general problem with repository like a webportal or your are blocked from access (wrong auth, Tor, …). Turns out some server like S3 return 403 if a file doesn't exist. Allowing this in general seems like a step backwards as 403 is a reasonable response if auth failed, so failing here seems better than letting those users run into problems. What we can do is show our insecure warnings through and allow the failures for insecure repos: If the repo is signed it is easy to add an InRelease file and if not you are setup for trouble anyhow. References: cbbf185c3c55effe47f218a07e7b1f324973a8a6
* allow multivalue fields in deb822 sources to be foldedDavid Kalnischkies2017-11-191-44/+46
| | | | | | | | | | | | | | | The documentation said "spaces", but there is no real reason to be so strict and only allow spaces to separate values as that only leads to very long lines if e.g. multiple URIs are specified which are again hard to deal with from a user PoV which the deb822 format is supposed to avoid. It also deals with multiple consecutive spaces and strange things like tabs users will surely end up using in the real world. The old behviour on encountering folded lines is the generation of URIs which end up containing all these whitespace characters which tends to mess really bad with output and further processing. Closes: 881875
* use store: instead of gzip: to open local changelogsDavid Kalnischkies2017-10-281-2/+2
| | | | Regression-Of: cc1f94c95373670fdfdb8e2d6cf9125181f7df0c
* Don't segfault if receiving a method warning on empty queueJulian Andres Klode2017-10-251-1/+1
| | | | | | | We would like to issue a warning about seccomp support in Configuration(), but since the queue is empty, there is no current item to show the URL for and we get a segfault. Show the protocol instead.
* Run the ProxyAutoDetect script in the sandbox againJulian Andres Klode2017-10-223-1/+13
| | | | | | | | The previous change moved running the proxy detection program from the method to the main process, so it runs as root and not as _apt. This brings it back into the sandbox. Gbp-Dch: ignore
* Run Proxy-Auto-Detect script from main processJulian Andres Klode2017-10-223-6/+38
| | | | | | | This avoids running the Proxy-Auto-Detect script inside the untrusted (well, less trusted for now) sandbox. This will allow us to restrict the http method from fork()ing or exec()ing via seccomp.
* Fix testsuite for and add new fields from dpkg 1.19Julian Andres Klode2017-10-202-4/+7
| | | | | | | | | | | tagfile-order.c: Add missing fields from dpkg 1.19 For binary packages, this is Build-Essential; for source packages, it is Description. test-bug-718329-...: Ignore control.tar.*, changes in dpkg 1.19 test-apt-extracttemplates: Fix for dpkg 1.19
* send the hashes for alternative file correctlyDavid Kalnischkies2017-10-051-4/+4
| | | | | | | | | This isn't really used by the acquire system at all at the moment and the only method potentially sending this information is file://, but that used to be working correctly before broken in 2013, so better fix it now and worry about maybe using the data some day later. Regression-Of: b3501edb7091ca3aa6c2d6d96dc667b8161dd2b9
* use pkgTagSection::Key in srcRecords parserDavid Kalnischkies2017-09-261-32/+34
| | | | | | | | | Using hardcoded array-indexes in the build-dependency parsing is efficient, but less discoverable and easier to break. We can avoid this by making it even more efficient (not that it would be noticeable) allowing us to do explicitly named comparisons instead. Gbp-Dch: Ignore
* allow empty build-dependency fields in the parserDavid Kalnischkies2017-09-261-1/+4
| | | | | | | | | | | APT used to parse only wellformed files produced by repository creation tools which removed empty files as pointless before apt would see them. Now that apt can be told to parse e.g. debian/control files directly, it needs to be a little more accepting through: We had this with comments already, now let it deal with the far more trivial empty fields. Closes: #875363
* Fix translator comment location for legacy target warningJulian Andres Klode2017-09-131-3/+5
| | | | | In commit Do not warn about duplicate "legacy" targets, we we added an if, that changed the .po files...
* CMake: Properly handle Udev missingJulian Andres Klode2017-09-101-2/+2
| | | | | | | When udev is not available, the variables for libraries and include paths are set to NOTFOUND rather than an empty string and CMake exits with an error. Use a generator expression to only use these variables when UDEV_FOUND is true.
* Directly link against libudev on Linux systemsJulian Andres Klode2017-09-093-52/+28
| | | | | | | | | | | | | | | | | | | We previously dlopen()ed it, but it seems painful to do that without any real gain, except for possibly not having libudev in the address space and not having code #ifdefed for Linux. The latter means that we are a bit more likely to break stuff for non-Linux systems now if we play with udev, but at least we don't end up with it silently breaking because of a libudev ABI break. The existing function pointers in the struct were renamed and kept for compat purposes. Fixes Debian/apt#48 Also adjust prepare-release to strip [linux-any] from build-depends for travis.
* cdrom: Don't hardcode "Files" field for copying source filesJulian Andres Klode2017-09-091-1/+15
| | | | | | This fails if no Files field exists anymore, for example, because the Sources index only contains SHA256 hashes. Instead check all hashes.