summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* don't leak an FD in lz4 (de)compressionDavid Kalnischkies2016-06-104-1/+66
| | | | | Seen first in #826783, but as this buglog also shows leaked uncompressed files as well we don't close it just yet.
* do not hang on piped input in PipedFileFdPrivateDavid Kalnischkies2016-06-103-3/+37
| | | | | This effects only compressors configured on the fly (rather then the inbuilt ones as they use a library).
* don't explicitly configure the last round of packagesDavid Kalnischkies2016-06-084-17/+11
| | | | | | | | | | | | We end our operation by calling "dpkg --configure -a", so instead of running a (big) configure run with all packages mentioned explicitly before this, we simply skip them and let them be handled by this call implicitly. There isn't really an observeable gain to be had here from a speed point, but it helps in avoiding an (uncommon) problem of having a too long commandline passed to dpkg, which we would split up (probably incorrectly).
* edsp: drop privileges before executing solversDavid Kalnischkies2016-06-081-1/+3
| | | | | | | | | | | | | | | Most (if not all) solvers should be able to run perfectly fine without root privileges as they get the entire state they are supposed to work on via stdin and do not perform any action directly, but just pass suggestions on via stdout. The new default is to run them all as _apt hence, but each solver can configure another user if it chooses/must. The security benefits are minimal at best, but it helps preventing silly mistakes (see 35f3ed061f10a25a3fb28bc988fddbb976344c4d) and that is always good. Note that our 'apt' and 'dump' solver already dropped privileges if they had them.
* edsp: optionally store a compressed copy of the last scenarioDavid Kalnischkies2016-06-081-3/+16
| | | | | | | | For bugreports and co it could be handy to have the scenario and all the settings used in it around later for inspection for EDSP like protocols. EDSP might not be the most interesting as the user can still interrupt the process before the solution is applied and users tend to have an opinion on the "rightness" of a solution, so it is disabled by default.
* edsp: use an ID mapping for the internal solverDavid Kalnischkies2016-06-041-0/+5
| | | | | | | Currently an EDSP solver gets send basically all versions which means the absolute count is the same, but that might not be true forever (and with the skipping of rc-only versions it kinda is already) and even if it were true, segfaulting on bad input seems wrong.
* apt-key: change to / before find to satisfy its CWD needsDavid Kalnischkies2016-06-021-106/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First seen on hurd, but easily reproducible on all systems by removing the 'execution' bit from the current working directory and watching some tests (mostly the no-output expecting tests) fail due to find printing: "find: Failed to restore initial working directory: …" Samuel Thibault says in the bugreport: | To do its work, find first records the $PWD, then goes to | /etc/apt/trusted.gpg.d/ to find the files, and then goes back to $PWD. | | On Linux, getting $PWD from the 700 directory happens to work by luck | (POSIX says that getcwd can return [EACCES]: Search permission was denied | for the current directory, or read or search permission was denied for a | directory above the current directory in the file hierarchy). And going | back to $PWD fails, and thus find returns 1, but at least it emitted its | output. | | On Hurd, getting $PWD from the 700 directory fails, and find thus aborts | immediately, without emitting any output, and thus no keyring is found. | | So, to summarize, the issue is that since apt-get update runs find as a | non-root user, running it from a 700 directory breaks find. Solved as suggested by changing to '/' before running find, with some paranoia extra care taking to ensure the paths we give to find are really absolute paths first (they really should, but TMPDIR=. or a similar Dir::Etc::trustedparts setting could exist somewhere in the wild). The commit takes also the opportunity to make these lines slightly less error ignoring and the two find calls using (mostly) the same parameters. Thanks: Samuel Thibault for 'finding' the culprit! Closes: 826043
* ignore std::locale exeception on non-existent "" localeDavid Kalnischkies2016-06-021-0/+2
| | | | | | | | In 8b79c94af7f7cf2e5e5342294bc6e5a908cacabf changing to usage of C++ way of setting the locale causes us to be terminated in case of usage of an ungenerated locale as LC_ALL (or similar) – but we don't want to fail here, we just want to carry on as before with setlocale which we call in that case just for good measure.
* accept only the expected UTC timezones in date parsingDavid Kalnischkies2016-05-282-2/+40
| | | | | | | | | | | | | | | | | | HTTP/1.1 hardcodes GMT (RFC 7231 §7.1.1.1) and what is good enough for the internet must be good enough for us™ as we reuse the implementation internally to parse (most) dates we encounter in various places like the Release files with their Date and Valid-Until header fields. Implementing a fully timezone aware parser just feels too hard for no effective benefit as it would take 5+ years (= until LTS's are out of fashion) until a repository could use non-UTC dates and expect it to work. Not counting non-apt implementations which might or might not only want to encounter UTC here as well. As a bonus, this eliminates the use of an instance of setlocale in libapt. Closes: 819697
* prevent C++ locale number formatting in text APIsDavid Kalnischkies2016-05-273-46/+42
| | | | | | | | | | | Setting the C++ locale via std::locale::global(std::locale("")); which would otherwise default to the default C locale (aka: unaffected by setlocale) effects the formatting of numeric types in IO streams, which for output for humans is perfectly sensible, but breaks our many text interfaces used and parsed by us and others without expecting the numbers to be formatted. Closes: #825396
* fix and document on the fly compressor configDavid Kalnischkies2016-05-271-12/+22
| | | | | | | libapt allows to configure compressors to be used by its system via configuration implemented in 03bef78461c6f443187b60799402624326843396, but that was never really documented and also only partly working, which also explains why the tests weren't using it…
* refactor EDSP code into EDSP and EDSP-like partsDavid Kalnischkies2016-05-201-9/+9
| | | | | | | No real code change, just moving code around heavily to decouple the EDSP specific parts from those we can reuse for EDSP-like protocols. Git-Dch: Ignore
* fail instead of segfault on unreadable config filesDavid Kalnischkies2016-05-201-24/+68
| | | | | | | | | | | | | The report mentions "apt list --upgradable", but there are others which have inconsistent behavior ranging from segfaulting to doing something with the partial (and hence incomplete) data. We had a recent report about sources.list (#818628), this one mentions prefences, the obvious next step is conf files… so the testcase is adapted to check for all three in file and directory versions and run a bunch of commands each time which should all have more or less the same behavior in such a case (aka error out). Closes: 824503
* show final solution in --no-download --fix-missing modeDavid Kalnischkies2016-05-162-1/+18
| | | | | | | | | | | | | | This commit moves the creation of the fetcher and with it the calculation of the filenames before the code generation the various lists detailing the solution. This means that simulation comes even so slightly closer to a real run as it will require and parse the package indexes for filenames and queuing of URIs, so that a simulation "using" an unavailable download method actually fails now. The real benefit of this change is through that the rather special but nontheless handy --no-download --fix-missing mode now actually shows what the solution is it will apply to the system rather than the solution it would if it could download all not-downloaded packages.
* show globalerrors before asking for confirmationDavid Kalnischkies2016-05-161-4/+5
| | | | | | | | | | | | | | Errors cause a kind of automatic no already, but warnings and notices are only displayed at the end of the apt execution even through they could effect the choice of saying yes/no to questions: E.g. if a configuration (file) was ignored you wanted to have an effect or if an external solver you used generated warnings suggesting that the solution might be valid, but bogus non-the-less and similar things. Note that this only moves those messages up to the question if the answer is interactive – not if e.g. -y is used or no question is asked at all so this has an effect only on interactive usage of apt(-get), not script who might be parsing apt output.
* Normalize Signed-By values by removing trailing commas everywhereJulian Andres Klode2016-05-151-0/+25
| | | | | This fixes comparisons where either the stored or the input string have a trailing comma.
* edsp: warn if unexpected stanzas appear in the solutionDavid Kalnischkies2016-05-121-1/+51
| | | | | | Unexpected are for examples removal requests for versions which aren't installed, installations of already installed versions & requests to install and remove a package at the same time.
* update: Run Post-Invoke-Success if not all sources failedJulian Andres Klode2016-05-101-0/+43
| | | | | | | | | | | | | | | | Failures can happen and APT regardless will do a partial cache update anyway. Because APT ensures that the list directory is in a sane state, it makes sense to also call success hooks if success was only partial - otherwise it loses sync with APT. Most importantly, this causes the appstream cache to be empty, see launchpad bug #1562733. This is somewhat overly optimistic though: As soon as any repository has nonexisting optional files, the missing optional files are also treated as success, which means a single broken repository without an InRelease file still runs Success hooks, even though it really should not.
* Strip trailing commas for created signed-by fingerprint listsJulian Andres Klode2016-05-101-0/+13
| | | | | This prevented some sources.list entries from working, an example of which can be found in the test.
* don't sent uninstallable rc-only versions via EDSPDavid Kalnischkies2016-05-101-23/+50
| | | | | | | | | | | Versions which are only available in dpkg/status aren't installable and apt doesn't pick them as candidate for this reason – for the same reason such packages shouldn't be sent to an external solver via EDSP. The packages are pinned to -1, but if the solver has strict pinning disabled it could end up picking this version anyhow – which is a request apt can not satisfy. Reported-By: Maximiliano Curia <maxy@debian.org> on IRC
* gpgv: show always webportal error on NODATADavid Kalnischkies2016-05-083-29/+37
| | | | | | | | | | | | | | | | | gpg doesn't give use a UID on NODATA, which we were "expecting" (but not using for anything), but just an error number. Instead of collecting these as badsigners which will trigger a "invald signature" error with remarks like "NODATA 1" we instead adapt a message similar to the NODATA error of a clearsigned file (which is actually not reached anymore as we split them up, which fails with a NOSPLIT error, which uses the same general error message). In other words: Not a security relevant change, just a user experience improvement as we now point them to the most likely cause of the problem instead of saying "invalid signature" which would point them in the direction of the archive being broken (for everyone) instead. Closes: 823746
* implement Identifier field for IndexTargetsDavid Kalnischkies2016-05-083-40/+50
| | | | | | | | | | | A frontend like apt-file is only interested in a specific set of files and selects those easily via "Created-By". If it supports two locations for those files through it would need to select both and a user would need to know that implementation detail for sources.list configuration. The "Identifier" field is hence introduced which by default has the same value as "Created-By", but can be freely configured – especially it can be used to give two indexes the same identifier.
* implement Fallback-Of for IndexTargetsDavid Kalnischkies2016-05-081-0/+58
| | | | | | | | | | | | | | | | Sometimes index files are in different locations in a repository as it is currently the case for Contents files which are per-component in Debian, but aren't in Ubuntu. This has historic reasons and is perhaps changed soon, but such cases of transitions can always happen in the future again, so we should prepare: Introduced is a new field declaring that the current item should only be downloaded if the mentioned item wasn't allowing for transitions without a flagday in clients and archives. This isn't implemented 'simpler' with multiple MetaKeys as items (could) change their descriptions and perhaps also other configuration bits with their location.
* download arch:all also for NATIVE_ARCHITECTURE indextargetsDavid Kalnischkies2016-05-071-8/+18
| | | | | | | It looks a bit strange on the outside to have multiple "native architecture", but all is considered an implementation detail and e.g. packages of arch:all are in dependency resolution equal to native packages.
* fix same-mirror redirection for Release{,.gpg} pairDavid Kalnischkies2016-05-071-0/+21
| | | | | | | | | | | Commit 9b8034a9fd40b4d05075fda719e61f6eb4c45678 just deals with InRelease properly and generates broken URIs in case the mirror (or the achieve really) has no InRelease file. [As this was in no released version no need to clutter changelog with a fix notice.] Git-Dch: Ignore
* tests: disable generation of Release.gpg by defaultDavid Kalnischkies2016-05-049-40/+27
| | | | | | | | | | | Most tests just need a signed repository and don't care if it signed by an InRelease file or a Release.gpg file, so we can save some time by just generating one of them by default. Sounds like not much, but quickly adds up to a few seconds with the amount of tests we have accumulated by now. Git-Dch: Ignore
* tests: allow to disable generation of InRelease/Release.gpg fileDavid Kalnischkies2016-05-046-45/+33
| | | | | | | If the test just signs release files to throw away one of them to test the other, we can just as well save the time and not create it. Git-Dch: Ignore
* test: fix permission issue if run as rootDavid Kalnischkies2016-05-041-0/+1
| | | | | | | Always those silly mistakes. Do what I mean, not what I said… Reported-By: Travis Git-Dch: Ignore
* allow redirection for items without a space in the desc againDavid Kalnischkies2016-05-031-0/+3
| | | | | | | | | | Broken in a4b8112b19763cbd2c12b81d55bc7d43a591d610. If an item has a description which includes no space and is redirected to another mirror the code which wants to rewrite the description expects a space in there, but can't find it and the unguarded substr command on the string will fail with an exception thrown… Guarding it properly and everything is fine.
* warn if apt-key is run unconditionally in maintainerscriptDavid Kalnischkies2016-05-011-0/+34
| | | | | | | | We want to stop hard-depending on gnupg and for this it is essential that apt-key isn't used in any critical execution path, which maintainerscript are. Especially as it is likely that these script call apt-key either only for (potentially now outdated cleanup) or still not use the much simpler trusted.gpg.d infrastructure.
* support Signed-By in Release files as a sort of HPKPDavid Kalnischkies2016-05-011-1/+51
| | | | | | | | | | | | Users have the option since apt >= 1.1 to enforce that a Release file is signed with specific key(s) either via keyring filename or fingerprints. This commit adds an entry with the same name and value (except that it doesn't accept filenames for obvious reasons) to the Release file so that the repository owner can set a default value for this setting effecting the *next* Release file, not the current one, which provides a functionality similar "HTTP Public Key Pinning". The pinning is in effect as long as the (then old) Release file is considered valid, but it is also ignored if the Release file has no Valid-Until at all.
* support multiple fingerprints in signed-byDavid Kalnischkies2016-05-011-7/+35
| | | | | A keyring file can include multiple keys, so its only fair for transitions and such to support multiple fingerprints as well.
* gpgv: cleanup statusfd parsing a bitDavid Kalnischkies2016-05-011-1/+1
| | | | | | | | | | | We parse the messages we receive into two big categories: Most of the messages have a keyid as well as a userid and as they are errors we want to show the userids as well. The other category is also errors, but have no userid (like NO_PUBKEY). Explicitly expressing this in code should make it a bit easier to look at and it also help in dropping additional fields or just the newline at the end consistently. Git-Dch: Ignore
* don't show NO_PUBKEY warning if repo is signed by another keyDavid Kalnischkies2016-05-014-26/+128
| | | | | | | | | | | | | | | Daniel Kahn Gillmor highlights in the bugreport that security isn't improving by having the user import additional keys – especially as importing keys securely is hard. The bugreport was initially about dropping the warning to a notice, but in given the previously mentioned observation and the fact that we weren't printing a warning (or a notice) for expired or revoked keys providing a signature we drop it completely as the code to display a message if this was the only key is in another path – and is considered critical. Closes: 618445
* gpgv: handle expired sig as worthlessDavid Kalnischkies2016-05-012-2/+27
| | | | | | | Signatures on data can have an expiration date, too, which we hadn't handled previously explicitly (no problem – gpg still has a non-zero exit code so apt notices the invalid signature) so the error message wasn't as helpful as it could be (aka mentioning the key signing it).
* gpgv: use EXPKEYSIG instead of KEYEXPIREDDavid Kalnischkies2016-05-011-2/+2
| | | | | | The upstream documentation says about KEYEXPIRED: "This status line is not very useful". Indeed, it doesn't mention which key is expired, and suggests to use the other message which does.
* show StateCache flags in Pkg debug prettyprintDavid Kalnischkies2016-05-013-18/+18
| | | | | | | | | | | This basically introduces ~33 flags in the output, but a package can have only ~11 of them displayed at the same time. There is quiet a bit of duplication also (an uninstalled package is by definition a newinstall if its getting installed), but as this is debug output we are better of showing them all in case one of them isn't set in a way it is supposed to be set. Git-Dch: Ignore
* deb822: Restore support for <multivalue>-{Add,Remove}James McCoy2016-04-281-0/+10
| | | | | | Redesign of multivalue options in 463c8d801595ce5ac94d7c032264820be7434232 caused the parser to look for <multivalue>{Add,Remove} (no hyphen) instead of the expected <multivalue>-{Add,Remove}.
* respect user pinning in M-A:same version (un)screwingDavid Kalnischkies2016-04-281-0/+32
| | | | | | | | | | | | Using Pkg.CandVersion() here is wrong as its implementation will return a candidate based just on the default policy settings ignoring user preferences and otherwise set candidates (aka: it sidesteps the pkgDepCache). This causes M-A:same libraries to be detected as screwed even through they aren't, so that they end up being kept back. Reported-By: Felipe Sateler on IRC
* restore pinning to min/max value of shortDavid Kalnischkies2016-04-251-1/+20
| | | | | | | | Broken in the previous commit (69cea1ef2cfda3c4da79fd756a8edaf2be26998e). Adding a test and a comment to avoid future embarrassment. Git-Dch: Ignore Reported-By: Julian Andres Klode on IRC
* use the same redirection mirror for all index filesDavid Kalnischkies2016-04-251-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Redirection services like httpredir.debian.org tend to use a set of mirrors from which they pick a mirror at "random" for each requested file, which is usually benefitial for the download of debs, but for the index files this can quickly cause problems (aka hashsum mismatches) if the two (or more) mirrors involved are only slightly out-of-sync. This commit "resolves" this issue by using the mirror we ended up using to get the (signed) Release file directly to get the index files belonging to this Release file instead of asking the redirection service which eliminates the risk of hitting out-of-sync mirrors. As an obvious downside the redirection service can't serve partial mirrors anymore for indexes and the download of indexes indexed in the same Release file can't be done in parallel (from different mirrors). This does not effect the download of non-index files like deb-files as out-of-sync mirrors aren't a huge problem there, so the parallel download outweights a potentially 404 error (also because this causes no errenous downloads while hashsum mismatches download the entire file before finding out that it was pointless). The rational for this is that indexes are relative to the Release file. If we would be talking about a HTML page including images, such a behaviour is obvious and intended – not doing it means in the best case a bunch of "useless" requests which will all be answered with a redirect.
* show more details for "Writing more data" errors, tooDavid Kalnischkies2016-04-252-4/+11
| | | | | | They are the small brothers of the hashsum mismatch, so they deserve a similar treatment even through we have for architectual reasons not a much to display as for hashsum mismatches for now.
* show more details for "Hash Sum mismatch" errorsDavid Kalnischkies2016-04-255-15/+208
| | | | | | | | | | | | | | | | Users tend to report these errors with just this error message… not very actionable and hard to figure out if this is a temporary or 'permanent' mirror-sync issue or even the occasional apt bug. Showing the involved hashsums and modification times should help in triaging these kind of bugs – and eventually we will have less of them via by-hash. The subheaders aren't marked for translation for now as they are technical glibberish and probably easier to deal with if not translated. After all, our iconic "Hash Sum mismatch" is translated at least. These additions were proposed in #817240 by Peter Palfrader.
* drop empty line from fetch errorDavid Kalnischkies2016-04-253-12/+4
| | | | | | | | This is a duplicate of sorts of 0efb29eb36184bbe6de7b1013d1898796d94b171 which is the a lot more frequent case of this error – and also a duplicate of this error message, just without the \n at the end. Git-Dch: Ignore
* properly format multiline error messagesDavid Kalnischkies2016-04-251-0/+34
|
* don't ask server if we have entire file in partial/David Kalnischkies2016-04-253-7/+27
| | | | | | | | | | | | We have this situation in cases were parts of the transaction are refused (e.g. in a hashsum mismatch) and rerun the update (e.g. in the hope that we get a mirror which is synced this time). Previously we would ask the server with an if-range and in the best case recieve a 416 in response (less featureful server might end up giving us the entire file again or we get the wrong file this time giving us a hashsum mismatch…), which is a waste of time if we know already by checking the hashsums that we got the complete and correct file.
* make random acquire queues work less randomDavid Kalnischkies2016-04-251-2/+4
| | | | | | | | | | | | | | Queues feeding workers like rred are created in a random pattern to get a few of them to run in parallel – but if we already have an idling queue we don't need to assign it to a (potentially new) random queue as that saves us the (agruably small) overhead of starting up a new queue, avoids adding jobs to an already busy queue while others idle and as a bonus reduces the size of debug logs a bit. We also keep starting new queues now until we reach our limit before we assign work at random to them, which should give us a more effective utilisation overall compared to potentially adding work to busy queues while we haven't reached our queue limit yet.
* ensure outdated files are dropped without lists-cleanupDavid Kalnischkies2016-04-141-0/+18
| | | | | Tested via (newly) empty index files, but effects also files dropped from the repository or an otherwise changed repository config.
* silently skip acquire of empty index filesDavid Kalnischkies2016-04-147-44/+32
| | | | | There is just no point in taking the time to acquire empty files – especially as it will be tiny non-empty compressed files usually.
* allow uncompressed files to be empty in store againDavid Kalnischkies2016-04-141-0/+25
| | | | | | | With the previous fix for file applied we can again hit repositories which contain uncompressed empty files, which since the introduction of the central store: method wasn't accounted for anymore as we forbid empty compressed files.