summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* typo: run s#frontend#front-end# on all of src:aptDavid Kalnischkies2015-11-252-2/+2
| | | | | | The manpages were fixed by Justin B Rye, lets deal with the rest now. Git-Dch: Ignore
* slightly rephrase notice shown for insecure repositoriesJustin B Rye2015-11-251-1/+1
| | | | Git-Dch: Ignore
* review of new/changed translatable program stringsJustin B Rye2015-11-214-13/+13
| | | | | Reference mail: https://lists.debian.org/debian-l10n-english/2015/11/msg00006.html
* do not sent Last-Modified if we expect a changed fileDavid Kalnischkies2015-11-211-4/+12
| | | | | | | | | | | | | | | | | | | | In 8d041b4f we made apt figure out based on the last Release file it has if it should request a file or not given that the hashes changed or not. So if we have a last Release file and do a request, do not sent a Last-Modified header as we expect a change so much that a non-change would indeed be an error. The Last-Modified header is therefore at best ignored by the server, so sending it is just wasted effort. In the worst case as time is a fragile thing the server decides against sending us an update with the idea that we already have the latest content, which we know for a fact that we haven't. Given that we sent less information to the server our request is on its own also less identifiable as coming from a returning or new user. The disadvantage is that if we end up getting an old index file after getting a new Release file from another mirror the old mirror will not be able to tell us 'Hit', but instead sends us the complete file we discard, but both lets us end up with the same error class in the end, so the difference isn't big in practice.
* fix a few typos in code-comments/apt manpageDavid Kalnischkies2015-11-201-1/+1
| | | | | Reported-By: codespell Git-Dch: Ignore
* do not segfault in cache generation on mmap failureDavid Kalnischkies2015-11-203-6/+21
| | | | | | | | | | | | | | | Out of memory and similar circumstanzas could cause MMap::Map to fail and especially the mmap/malloc calls in it. With some additional checking we can avoid segfaults and similar in such situations – at least in theory as if this is a real out of memory everything we do to handle the error could just as well run into a memory problem as well… But at least in theory (if MMap::Map is made to fail always) we can deal with it so good that a user actually never sees a failure (as the cache it tries to load with it fails and is discarded, so that DynamicMMap takes over and a new one is build) instead of segfaulting. Closes: 803417
* ignore lost+found in private directory cleanupDavid Kalnischkies2015-11-192-0/+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
* support setting empty values (sanely) & removing support forDavid Kalnischkies2015-11-191-20/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* do not use _apt for file/copy sources if it isn't world-accessibleDavid Kalnischkies2015-11-193-31/+86
| | | | | | | | | | | | | | | | | | | | | | In 0940230d we started dropping privileges for file (and a bit later for copy, too) with the intend of uniforming this for all methods. The commit message says that the source will likely fail based on the compressors already – and there isn't much secret in the repository content. After all, after apt has run the update everyone can access the content via apt anyway… There are sources through which worked before which are mostly single-deb (and those with the uncompressed files available). The first one being especially surprising for users maybe, so instead of failing, we make it so that apt detects that it can't access a source as _apt and if so doesn't drop (for all sources!) privileges – but we limit this to file/copy, so the uncompress which might be needed will still fail – but that failed before this regression. We display a notice about this, mostly so that if it still fails (e.g. compressed) the user has some idea what is wrong. Closes: 805069
* "support" unsigned Release files without hashes againDavid Kalnischkies2015-11-051-3/+4
| | | | | | | | | This 'ignores' the component Release files you can find in Debian alongside the binary-* directories, which isn't exactly a common usecase, but it worked before, so lets support it again as this isn't worse than a valid Release file which is unsigned. Git-Dch: Ignore
* encode UTF-8 characters correctly in QuoteStringDavid Kalnischkies2015-11-051-1/+1
| | | | | | | Limit the field length to a char to avoid bogus FF for utf-8 characters with the default length. Closes: 799123
* apply various suggestions made by cppcheckDavid Kalnischkies2015-11-056-14/+9
| | | | | Reported-By: cppcheck Git-Dch: Ignore
* do not use read() returned value unconditionallyDavid Kalnischkies2015-11-051-24/+17
| | | | | | | A slightly unlikely bug, but lets fix it while slightly reworking this whole function to be slightly saner to look at, even if still not good. Git-Dch: Ignore
* wrap every unlink call to check for != /dev/nullDavid Kalnischkies2015-11-0410-39/+38
| | | | | | | | | | | | | | | | Unlinking /dev/null is bad, we shouldn't do that. Also, we should print at least a warning if we tried to unlink a file but didn't manage to pull it of (ignoring the case were the file is /dev/null or doesn't exist in the first place). This got triggered by a relatively unlikely to cause problem in pkgAcquire::Worker::PrepareFiles which would while temporary uncompressed files (which are set to keep compressed) figure out that to files are the same and prepare for sharing by deleting them. Bad move. That also shows why not printing a warning is a bad idea as this hide the error for in non-root test runs. Git-Dch: Ignore
* ensure FileFd doesn't try to open /dev/null as atomic and coDavid Kalnischkies2015-11-041-6/+10
| | | | | | | | | | The wrapping will fail in the best case and actually end up deleting /dev/null in the worst case. Given that there is no point in trying to write atomically to /dev/null as you can't read from it again just ignore these flags if higher level code ends up trying to use them on /dev/null. Git-Dch: Ignore
* ignore newlines in dpkg-deb control output for installing debsDavid Kalnischkies2015-11-041-4/+13
| | | | | | | | | | | Leading or trailing newlines can be confusing for our parser as it expects two newlines to start/stop a new stanza. To solve this the lines we wanna add are printed first, ignore any leading newlines and then add the stanza as provided by dpkg-deb with or without trailing newlines as the parser will look at the first stanza only anyway and removing trailing newlines is considerably harder to do. Closes: 802553
* support arch:all data e.g. in separate Packages fileDavid Kalnischkies2015-11-046-4/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sanify API to get 'the' candidate versionDavid Kalnischkies2015-11-046-9/+35
| | | | | | | | | This was discussed a while ago on #debian-apt and now that I see myself making this mistake lets bite the bullet and fix it in the easy way out version: Using a new name which fits with a similar named setter and deprecate the old method instead of 'hostily' changing API. Closes: #803471
* centralize unlink checks in acquire-itemDavid Kalnischkies2015-11-041-16/+30
| | | | | | | | Removals in the acquire progress can be pretty important, so a failure should be silently ignored, so we wrap our unlink call in a slightly more forgiving wrapper checking things. Git-Dch: Ignore
* do not cleanup .diff/Index files on HitDavid Kalnischkies2015-11-041-0/+3
| | | | Git-Dch: Ignore
* move apts cmdline helper type into -privateDavid Kalnischkies2015-11-042-68/+5
| | | | | | | | Its not as simple as I initially thought to abstract this enough to make it globally usable, so lets not pollute global namespace with this for now. Git-Dch: Ignore
* new quiet level -qq for apt to hide progress outputDavid Kalnischkies2015-11-041-1/+1
| | | | | | | | | -q is for logging and -qqq (old -qq) basically kills every output expect errors, so there should be a way of declaring a middleground in which the output of e.g. 'update' isn't as verbose, but still shows some things. The test framework was actually making use of by accident as it ignored the quiet level in output setup for apt before. Eventually we should figure out some better quiet levels for all tools…
* deduplicate main methodsDavid Kalnischkies2015-11-042-2/+2
| | | | | | | | All mains pretty much do the same thing, so lets try a little harder to move the common parts into -private to have the real differences more visible. Git-Dch: Ignore
* split up help messages for simpler reuseDavid Kalnischkies2015-11-042-2/+71
| | | | | | | | | | | | | That is one huge commit with busy work only: Help messages used to be one big translateable string, which is a pain for translators and hard to reuse for us. This change there 'explodes' this single string into new string for each documented string trying hard to split up the translated messages as well. This actually restores many translations as previously adding a single command made all of the bug message fuzzy. The splitup also highlighted that its easy to forget a line, duplicate one and similar stuff. Git-Dch: Ignore
* add binary-specific options via Binary scopeDavid Kalnischkies2015-11-042-0/+55
| | | | | | Especially with apt now, it can be useful to set an option only for apt and not for apt-get. Using a binary-specific subtree which is merged into the root seems like a simple enough trick to achieve this.
* refer to apt-secure(8) in unsecure repositories warningDavid Kalnischkies2015-11-041-1/+1
| | | | | | 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-22/+39
| | | | | | | | | | | | | | | | 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
* add ConnectionTimedOut to transient failreasons listDavid Kalnischkies2015-11-041-6/+10
| | | | | | All other reasons from methods/connect.cc were already included. Git-Dch: Ignore
* support .deb files in upgrade operations as wellDavid Kalnischkies2015-11-043-9/+40
| | | | | | The main part is refactoring through to allow hiding the magic needed to support .deb files in deeper layers of libapt so that frontends have less exposure to Debian specific classes like debDebPkgFileIndex.
* show progress info while 'downloading' a local .deb fileDavid Kalnischkies2015-11-043-3/+17
| | | | | Showing just "Get: [1234 B]" looks very strange, so we now print the filename and as usual the package name, version and architecture.
* unbreak the copy-method claiming hashsum mismatch since ~exp9David Kalnischkies2015-11-041-13/+22
| | | | | | | | | | | | | | | | 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
* allow all dpkg selections to be set via apt-mark and libaptDavid Kalnischkies2015-11-042-33/+73
| | | | | | As we have support for 'hold', we need support for undoing a hold which in effect means that we implemented most other states as well, just that they weren't exposed in the interface directly so far.
* provide public interface to hold/unhold packagesDavid Kalnischkies2015-11-045-7/+190
| | | | | | We had this code lying around in apt-mark for a while now, but other frontends need this (and similar) functionality as well, so its high time that we provide a public interface in libapt for this stuff.
* refactor dpkg execution in deb/debsystemDavid Kalnischkies2015-11-041-47/+61
| | | | | | We have a few places and there will be a few more still where we have to call dpkg to detect/set certain features or settings. Centralizing the calling infrastructure now seems like a good idea before we add another.
* add cacheset push_back wrapping for std::back_inserterDavid Kalnischkies2015-11-041-1/+27
| | | | | | | | | | | | As usual by now, not all containers wrapped by the cacheset containers support all methods, like push_back now, but they fail on use of these unusable methods only. Would be nice to not expose these methods for unsupporting containers at all, but that means either a lot of classes or a lot of std::enable_if magic, which seems like too big work for this small wrapper for now. Git-Dch: Ignore
* implement operator* for cacheset iteratorsDavid Kalnischkies2015-11-041-1/+20
| | | | | | | | | | | | | | | | Technically an abi-break as we change a template parameter to std::iterator for this, but this class is empty in all instances and just causes the right typedefs to be set – which were incorrect as detected by std::stable_partition as its implementation uses ::pointer and needs also a operator* implementation. In practice CacheSets have no external users (yet) and the difference is visible only at compile time (which was an error before and now works), not while linking. The changes to apt-mark are functionally identical to the code before, just that we use a std:: algorithm now instead of trying hard on our own.
* implement a public pkgSystem::ArchitecturesSupportedDavid Kalnischkies2015-11-045-83/+82
|
* implement a public pkgSystem::MultiArchSupportedDavid Kalnischkies2015-11-045-82/+130
| | | | | | Some codepaths need to check if the system (in our case usually dpkg) supports MultiArch or not. We had copy-pasted the check so far into these paths, but having it as a system check is better for reusability.
* orderlist: Replace qsort() by thread-safe std::sort()Julian Andres Klode2015-10-302-24/+20
| | | | Gbp-Dch: ignore
* algorithms: Replace qsort() by thread-safe std::sort()Julian Andres Klode2015-10-302-39/+45
| | | | Gbp-Dch: ignore
* dpkgpm: Convert users of localtime() to localtime_r()Julian Andres Klode2015-10-301-2/+4
| | | | | | The former is not thread-safe, whereas the latter is. Gbp-Dch: ignore
* cacheset: Fix compilation on new GCC in C++98 modeJulian Andres Klode2015-10-301-3/+3
| | | | | | | | | | | | | Since gcc 4.9, the API for erase slightly changed. In commit 3dddcdf2432e78f37c74d8c76c2c519a8d935ab2 the existing checks for __cplusplus where changed to check the gcc version, as the __cplusplus check did nothing, because gcc 4.8 already provided the standard value in there. Fix the code to check for the gcc version in two more places, and change the existing checks to use a convenience macro.
* srvrec: Do not expose C++11 tuple use in headerJulian Andres Klode2015-10-302-4/+8
| | | | This makes non-C++11 reverse deps wishing to use it FTBFS.
* dpkgpm: Use ptsname_r() instead of ptsname() to be thread-safeJulian Andres Klode2015-10-301-0/+5
| | | | | | | This function only exists on a limited number of platforms, so we add a configure check to make sure it exists. Gbp-Dch: ignore
* dpkgpm: Convert ctime() call to ctime_r()Julian Andres Klode2015-10-301-1/+2
| | | | | | ctime() is not thread-safe, ctime_r() is. Gbp-Dch: ignore
* aptconfiguration: Convert strtok() to strtok_r()Julian Andres Klode2015-10-301-2/+3
| | | | | | strtok() is not thread-safe, whereas strtok_r() is. Gbp-Dch: ignore
* GetSrvRecords: Make thread-safeJulian Andres Klode2015-10-301-2/+7
| | | | Gbp-Dch: ignore
* deblistparser: Make PrioList constJulian Andres Klode2015-10-232-3/+3
| | | | More safety, less writeable memory.
* Revert "Fix select timeout to be 50msec instead of 0.5msec" for acquireJulian Andres Klode2015-10-111-1/+1
| | | | | | | | | | | The acquire system actually uses usec pulse intervals, so the previous value was correct (500ms) whereas the new value is now 5s. It's a bit unfortunate that the two systems use different units for pulse intervals, but probably not much we can do about it. This partially reverts commit eaf21c2144fa8dc4be8581dc69cf88cb38e30ce2.
* Fix select timeout to be 50msec instead of 0.5msecMichael Vogt2015-09-302-2/+2
| | | | Closes: #799857