summaryrefslogtreecommitdiff
path: root/test/integration/framework
Commit message (Collapse)AuthorAgeFilesLines
* do not hang on piped input in PipedFileFdPrivateDavid Kalnischkies2016-06-101-2/+6
| | | | | This effects only compressors configured on the fly (rather then the inbuilt ones as they use a library).
* 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.
* gpgv: show always webportal error on NODATADavid Kalnischkies2016-05-081-2/+3
| | | | | | | | | | | | | | | | | 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
* tests: disable generation of Release.gpg by defaultDavid Kalnischkies2016-05-041-0/+3
| | | | | | | | | | | 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-041-4/+14
| | | | | | | 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
* don't show NO_PUBKEY warning if repo is signed by another keyDavid Kalnischkies2016-05-011-23/+44
| | | | | | | | | | | | | | | 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-011-2/+4
| | | | | | | 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).
* show more details for "Hash Sum mismatch" errorsDavid Kalnischkies2016-04-251-7/+13
| | | | | | | | | | | | | | | | 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.
* don't ask server if we have entire file in partial/David Kalnischkies2016-04-251-4/+12
| | | | | | | | | | | | 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.
* silently skip acquire of empty index filesDavid Kalnischkies2016-04-141-0/+6
| | | | | There is just no point in taking the time to acquire empty files – especially as it will be tiny non-empty compressed files usually.
* properly check for "all good sigs are weak"David Kalnischkies2016-03-211-1/+1
| | | | | | | | | | Using erase(pos) is invalid in our case here as pos must be a valid and derefenceable iterator, which isn't the case for an end-iterator (like if we had no good signature). The problem runs deeper still through as VALIDSIG is a keyid while GOODSIG is just a longid so comparing them will always fail. Closes: 818910
* tests: reenable basic auth test and add @ in usernameDavid Kalnischkies2016-03-191-2/+2
| | | | | | | | | | On launchpad #1558484 a user reports that @ in the authentication tokens parsing of sources.list isn't working in an older (precise) version. It isn't the recommended way of specifying passwords and co (auth.conf is), but we can at least test for regressions (and in this case test at all… who was that "clever" boy disabling a test with exit……… oh, nevermind. Git-Dch: Ignore
* test framework: Pass -n to lsof to speed up finding the https portJulian Andres Klode2016-03-171-1/+1
| | | | | | | | There is no point in resolving all addresses to their names, this just seriously slows the setup phase down. So just pass -n to not resolve names anymore. Gbp-Dch: ignore
* Fix bug where the problemresolve can put a pkg into a heisenstateMichael Vogt2016-03-151-0/+1
| | | | | | | | | | | | | | | | The problemresolver will set the candidate version for pkg P back to the current version if it encounters an impossible to satisfy critical dependency on P. However it did not set the State of the package back as well which lead to a situation where P is neither in Keep,Install,Upgrade,Delete state. Note that this can not be tested via the traditional sh based framework. I added a python-apt based test for this. LP: #1550741 [jak@debian.org: Make the test not fail if apt_pkg cannot be imported]
* test: Move --weak-digest initialization to the right placeJulian Andres Klode2016-03-141-3/+6
| | | | | | | This was wrong and caused some issues because apt-key invoked host apt-config with our library. Gbp-Dch: ignore
* test: Use SHA512 digests for GPG, reject SHA1-based signaturesJulian Andres Klode2016-03-141-1/+5
| | | | | This makes the test suite safe if we ever need to reject SHA1 signatures in an update.
* Do not consider SHA1 usableJulian Andres Klode2016-03-131-1/+1
| | | | | SHA1 is not reasonably secure anymore, so we should not consider it usable anymore. The test suite is adjusted to account for this.
* tests: expect no output while compiling noopchrootDavid Kalnischkies2016-03-061-3/+7
| | | | | | This way we hopefully notice (new) warnings in this little helper. Git-Dch: Ignore
* test: Fix apt-key tests to work with current gpg 2.1Julian Andres Klode2016-02-041-1/+11
|
* only warn about missing/invalid Date field for nowDavid Kalnischkies2016-01-271-0/+8
| | | | | | | | | | | | | | | | | | | | | The Date field in the Release file is useful to avoid allowing an attacker to 'downgrade' a user to earlier Release files (and hence to older states of the archieve with open security bugs). It is also needed to allow a user to define min/max values for the validation of a Release file (with or without the Release file providing a Valid-Until field). APT wasn't formally requiring this field before through and (agrueable not binding and still incomplete) online documentation declares it optional (until now), so we downgrade the error to a warning for now to give repository creators a bit more time to adapt – the bigger ones should have a Date field for years already, so the effected group should be small in any case. It should be noted that earlier apt versions had this as an error already, but only showed it if a Valid-Until field was present (or the user tried to used the configuration items for min/max valid-until). Closes: 809329
* get sources for packages in multiple releases againDavid Kalnischkies2016-01-261-10/+12
| | | | | | | | | In 321213f0dcdcdaab04e01663e7a047b261400c9c Andreas Cadhalpun corrected the incorrect overriding of earlier better-fitting results with later (semi-)matches – but that broke the case in which packages are in multiple releases in the same version (and the user has both releases configured). Closes: 812497
* tests: limit autotest-functionname generation to sane charactersDavid Kalnischkies2016-01-081-3/+3
| | | | | | | | Some (older) versions of bash seem to be allergic to a method named "aptautotest_grep_^apt" (note the caret). Unlikely that we are going to write autotests for such commands so we could just skip those, but lets instead just use "normal" characters in the names and strip the rest as we already did with the (arguable more common) '-'.
* support '-' and no parameter for stdin in apt-helper cat-fileDavid Kalnischkies2016-01-081-19/+5
| | | | | | This way it works more similar to the compressor binaries, which we can relief in this way from their job in the test framework avoiding the need of adding e.g. liblz4-tool to the test dependencies.
* keep compressed indexes in a low-cost formatDavid Kalnischkies2016-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Downloading and storing are two different operations were different compression types can be preferred. For downloading we provide the choice via Acquire::CompressionTypes::Order as there is a choice to be made between download size and speed – and limited by whats available in the repository. Storage on the other hand has all compressions currently supported by apt available and to reduce runtime of tools accessing these files the compression type should be a low-cost format in terms of decompression. apt traditionally stores its indexes uncompressed on disk, but has options to keep them compressed. Now that apt downloads additional files we also deal with files which simply can't be stored uncompressed as they are just too big (like Contents for apt-file). Traditionally they are downloaded in a low-cost format (gz) as repositories do not provide other formats, but there might be even lower-cost formats and for download we could introduce higher-cost in the repositories. Downloading an entire index potentially requires recompression to another format, so an update takes potentially longer – but big files are usually updated via pdiffs which has to de- and re-compress anyhow and does it on the fly anyhow, so there is no extra time needed and in general it seems to be benefitial to invest the time in update to save time later on file access.
* tests: try to pick up compressors from config automaticallyDavid Kalnischkies2016-01-081-10/+12
| | | | | | Less hardcoding should help while introducing new compressors. Git-Dch: Ignore
* tests: support gpg2 properly in all testcasesDavid Kalnischkies2015-12-191-2/+37
| | | | | | | | | The output changes slightly between different versions, which we already dealt with in the main testcase for apt-key, but there are two more which do not test both versions explicitly and so still had gpg1 output to check against as this is the default at the moment. Git-Dch: Ignore
* avoid evaluating shell in paths used in apt-keyDavid Kalnischkies2015-12-191-3/+13
| | | | | | | | | | | | apt-key creates internally a script (since ~1.1) which it will call to avoid dealing with an array of different options in the code itself, but while writing this script it wraps the values in "", which will cause the shell to evaluate its content upon execution. To make 'use' of this either set a absolute gpg command or TMPDIR to something as interesting as: "/tmp/This is fü\$\$ing cràzy, \$(man man | head -n1 | cut -d' ' -f1)\$!" If such paths can be encountered in reality is a different question…
* tests: support spaces in path and TMPDIRDavid Kalnischkies2015-12-191-14/+12
| | | | | | | This doesn't allow all tests to run cleanly, but it at least allows to write tests which could run successfully in such environments. Git-Dch: Ignore
* test framework: More noopchroot fixesJulian Andres Klode2015-12-141-6/+11
| | | | | | | | | | | Use asprintf() so we have easy error detection and do not depend on PATH_MAX. Do not add another separator to the generated path, in both cases the path inside the chroot is guaranteed to have a leading / already. Also pass -Wall to gcc.
* test framework: Unset no_proxy as wellJulian Andres Klode2015-12-141-1/+1
| | | | | | This caused test-bug-717891-abolute-uris-for-proxies to fail Gbp-Dch: ignore
* test framework: Unset http proxy variables in setupenvironmentJulian Andres Klode2015-12-141-0/+1
| | | | | | This breaks a lot of test cases Gbp-Dch: ignore
* test framework: Correctly generate new paths in noopchrootJulian Andres Klode2015-12-141-6/+5
| | | | | | The allocated buffer was one byte too small. Allocate a buffer of PATH_MAX instead and use snprintf(), as suggested by Martin Pitt.
* non-existing directories don't need to be cleanedDavid Kalnischkies2015-12-141-1/+4
| | | | | | | | | | Trying to clean up directories which do not exist seems rather silly if you think about it, so let apt think about it and stop it. Depends a bit on the caller if this is fixing anything for them as they might try to acquire a lock or doing other clever things as apt does. Closes: 807477
* show a more descriptive error for weak Release filesDavid Kalnischkies2015-12-141-0/+13
| | | | | | | | | | | | | | If we can't work with the hashes we parsed from the Release file we display now an error message if the Release file includes only weak hashes instead of downloading the indexes and failing to verify them with "Hash Sum mismatch" even through the hashes didn't mismatch (they were just weak). If for some (unlikely) reason we have got weak hashes only for individual targets we will show a warning to this effect (again, befor downloading and failing the index itself). Closes: 806459
* replace "which" with "command -v" for portabilityDavid Kalnischkies2015-12-061-1/+1
| | | | | | | | which is a debian specific tool packaged in debianutils (essential) while command is a shell builtin defined by POSIX. Closes: 807144 Thanks: Mingye Wang for the suggestion.
* tests: fix typos, correct helpmsgs and test testsDavid Kalnischkies2015-11-291-5/+5
| | | | Git-Dch: Ignore
* disable privilege-drop verification by default as fakeroot trips over itDavid Kalnischkies2015-11-281-0/+2
| | | | | | | | | | | | | Dropping privileges is an involved process for code and system alike so ideally we want to verify that all the work wasn't in vain. Stuff designed to sidestep the usual privilege checks like fakeroot (and its many alternatives) have their problem with this through, partly through missing wrapping (#806521), partly as e.g. regaining root from an unprivileged user is in their design. This commit therefore disables most of these checks by default so that apt runs fine again in a fakeroot environment. Closes: 806475
* tests: use id to get user/group instead of environmentDavid Kalnischkies2015-11-281-2/+2
| | | | | | | debci seems to have a cleaner environment now and even if not we could never guess nogroup, so figure it out properly via 'id'. Git-Dch: Ignore
* ignore lost+found in private directory cleanupDavid Kalnischkies2015-11-191-2/+2
| | | | | | | | | | In ce1f3a2c we started warning about failing unlinking, which we consistently do for directories. That isn't a problem as directories usually aren't in the places we do want to clean up – with the potential exeception of "lost+found", so lets ignore it like we ignore our own partial/ subdirectory. Closes: 805424
* tests: use quiet level 0 by default in testsDavid Kalnischkies2015-11-191-2/+4
| | | | Git-Dch: Ignore
* support setting empty values (sanely) & removing support forDavid Kalnischkies2015-11-191-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | space-gapping: '-o option= value' That is a very old feature (straight from 1998), but it is super surprising if you try setting empty values and instead get error messages or a non-empty value as the next parameter is treated as the value – which could have been empty, so if for some reason you need a compatible way of setting an empty value try: '-o option="" ""'. I can only guess that the idea was to support '-o option value', but we survived 17 years without it, we will do fine in the future I guess. Similar is the case for '-t= testing' even through '-t testing' existed before and the code even tried to detect mistakes like '-t= -b' … all gone now. Technically that is as its removing a feature replacing it with another a major interface break. In practice I really hope for my and their sanity that nobody was using this; but if for some reaon you do: Remove the space and be done. I found the patch and the bugreport actually only after the fact, but its reassuring that others are puzzled by this as well and hence a thanks is in perfect order here as the patch is practical identical [expect that this one here adds tests and other bonus items]. Thanks: Daniel Hartwig for initial patch. Closes: 693092
* tests: fail testsuccess if notices are shown, tooDavid Kalnischkies2015-11-181-16/+50
| | | | | | | | Notices are just hints, but if they are printed in tests, they should be expected and if not the test should fail. No current test has this problem, so that is just potential future proving. Git-Dch: Ignore
* allow acquire method specific options via Binary scopeDavid Kalnischkies2015-11-051-7/+7
| | | | | | | | Allows users who know what they are getting themselves into with this trick to e.g. disable privilege dropping for e.g. file:// until they can fix up the permissions on those repositories. It helps also the test framework and people with a similar setup (= me) to run in less modified environments.
* allow getaddrinfo flag AI_ADDRCONFIG to be disabledDavid Kalnischkies2015-11-041-0/+1
| | | | | | | | | This flags is generally handy to avoid having to deal with ipv6 results on an ipv4-only system, but it prevents e.g. the testcases from working if the testsystem has no configured address at the moment (expect loopback), so allow it to be sidestepped and let the testcases sidestep it. Git-Dch: Ignore
* support arch:all data e.g. in separate Packages fileDavid Kalnischkies2015-11-041-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on a discussion with Niels Thykier who asked for Contents-all this implements apt trying for all architecture dependent files to get a file for the architecture all, which is treated internally now as an official architecture which is always around (like native). This way arch:all data can be shared instead of duplicated for each architecture requiring the user to download the same information again and again. There is one problem however: In Debian there is already a binary-all/ Packages file, but the binary-any files still include arch:all packages, so that downloading this file now would be a waste of time, bandwidth and diskspace. We therefore need a way to decide if it makes sense to download the all file for Packages in Debian or not. The obvious answer would be a special flag in the Release file indicating this, which would need to default to 'no' and every reasonable repository would override it to 'yes' in a few years time, but the flag would be there "forever". Looking closer at a Release file we see the field "Architectures", which doesn't include 'all' at the moment. With the idea outlined above that 'all' is a "proper" architecture now, we interpret this field as being authoritative in declaring which architectures are supported by this repository. If it says 'all', apt will try to get all, if not it will be skipped. This gives us another interesting feature: If I configure a source to download armel and mips, but it declares it supports only armel apt will now print a notice saying as much. Previously this was a very cryptic failure. If on the other hand the repository supports mips, too, but for some reason doesn't ship mips packages at the moment, this 'missing' file is silently ignored (= that is the same as the repository including an empty file). The Architectures field isn't mandatory through, so if it isn't there, we assume that every architecture is supported by this repository, which skips the arch:all if not listed in the release file.
* disable updating insecure repositories in apt by defaultDavid Kalnischkies2015-11-041-11/+1
| | | | | | apt is an interactive command and the reasons we haven't this option set for everything is mostly in keeping compatibility for a little while longer to allow scripts to be changed if need be.
* refer to apt-secure(8) in unsecure repositories warningDavid Kalnischkies2015-11-041-2/+2
| | | | | | The manpage is also slightly updated to work better as a central hub to push people from all angles into the right directions without writting a book disguised as an error message.
* rework errors and warnings around insecure repositoriesDavid Kalnischkies2015-11-041-0/+11
| | | | | | | | | | | | | | | | Insecure (aka unsigned) repositories are bad, period. We want to get right of them finally and as a first step we are printing scary warnings. This is already done, this commit just changes the messages to be more consistent and prevents them from being displayed if authenticity is guaranteed some other way (as indicated with trusted=yes). The idea is to first print the pure fact like "repository isn't signed" as a warning (and later as an error), while giving an explaination in a immediately following notice (which is displayed only in quiet level 0: so in interactive use, not in scripts and alike). Closes: 796549
* unbreak the copy-method claiming hashsum mismatch since ~exp9David Kalnischkies2015-11-041-1/+4
| | | | | | | | | | | | | | | | Commit 653ef26c70dc9c0e2cbfdd4e79117876bb63e87d broke the camels back in sofar that everything works in terms of our internal use of copy:/, but external use is completely destroyed. This is kinda the reverse of what happened in "parallel" in the sid branch, where external use was mostly fine, internal and external exploded on the GzipIndexes option. We fix this now by rewriting our internal use by letting copy:/ only do what the name suggests it does: Copy files and not uncompress them on-the-fly. Then we teach copy and the uncompressors how to deal with /dev/null and use it as destination file in case we don't want to store the uncompressed files on disk. Closes: 799158
* tests: add a -j $jobs mode to test runner for parallel executionDavid Kalnischkies2015-09-151-1/+9
| | | | | | | | | | Now that tests can be run in parallel, lets actually do it… The mode has some downsides like not collecting the failed tests, but it can be a lot faster than a sequential run and is therefore a good alternative in testing those "this shouldn't break anything" changes (which tend to break everything if untested). Git-Dch: Ignore