summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* rework cachesets API to allow future extensionDavid Kalnischkies2014-09-272-144/+484
| | | | | | | | | | | | | | | The introduction of Fnmatch showed that each new selector would require multiple new virtual methods in the CacheSetHelper to work correctly, which isn't that great. We now flip to a single virtual method which handles all cases separated by an enum – as new enum values can be added without an ABI break. Great care was taken to make old code work with the new way of organisation, which means in return that you might be bombarded with deprecation warnings now if you don't adapt, but code should still compile and work as before as can be seen in apt itself with this commit. Git-Dch: Ignore
* add APT::PackageUniverse as a pkgCache wrapperDavid Kalnischkies2014-09-271-0/+38
| | | | Git-Dch: Ignore
* add specialisations for std::vectorDavid Kalnischkies2014-09-271-2/+73
| | | | Git-Dch: Ignore
* mark pkg(All|Dist)Upgrade as deprecatedDavid Kalnischkies2014-09-272-4/+13
| | | | | | | | The comment above their definition marks them already as such, so this is only a formalisation of the deprecation and fixes the occurances we have in our own code together with removing a magic number. Git-Dch: Ignore
* fix progress output for (dist-)upgrade calculationDavid Kalnischkies2014-09-274-55/+87
| | | | | | | | | | | | | | | | | Previously, we had a start and a done of the calculation printed by higher-level code, but this got intermixed by progress reporting from an external solver or the output of autoremove code… The higherlevel code is now only responsible for instantiating a progress object of its choosing (if it wants progress after all) and the rest will be handled by the upgrade code. Either it is used to show the progress of the external solver or the internal solver will give some hints about its overall progress. The later isn't really a proper progress as it will jump forward after each substep, but that is at least a bit better than before without any progress indication. Fixes also the 'strange' non-display of this progress line in -q=1, while all others are shown, which is reflected by all testcase changes.
* de-duplicate version strings in the cacheDavid Kalnischkies2014-09-271-3/+3
| | | | | | | | | | | | | | | Turns out that version numbers aren't as random as you might guess. In my cache for example, I have: Total package names: 69513 (1390 k) Total package structures: 188259 (9036 k) Total distinct versions: 186345 (13.4 M) Total dependencies: 2052242 (57.5 M) which amounts to 1035873 (10,1 M) strings. Reusing version strings reduces this to 161465 (3.479 k). This comes at a cost of course: Generation is slightly slower, but we are still faster than what we started with and it makes room (also cache size wise) for further changes.
* drop stored StringItems in favor of in-memory mappingsDavid Kalnischkies2014-09-278-124/+57
| | | | | | | | | | | | | | | Strings like Section names or architectures are needed vary often. Instead of writing them each time we need them, we deploy sharing for these special strings. Until now, this was done with a linked list of strings in which we would search, which was stored in the cache. It turns out we can do this just as well in memory as well with a bunch of std::map's. In memory means here that it isn't available anymore if we have a partly invalid cache, but that isn't much of a problem in practice as the status file is compared to the other files we parse very small and includes mostly duplicates, so the space we would gain by storing is more or less equal to the size of the stored linked list…
* packages in the cache are sorted by name so noise-freeDavid Kalnischkies2014-09-271-9/+2
| | | | | | | | | | Commit aa0fe657e46b87cc692895a36df12e8b74bb27bb sorts the package names in the hashtable. We make use of this already in these functions, but as a minor sideeffect it also means that we don't have 'noise' anymore between packages belonging to the same group. We therefore don't need to check for a matching name in Grp.FindPkg anymore. Git-Dch: Ignore
* search for pkg names in the cache case-sensitiveDavid Kalnischkies2014-09-271-4/+4
| | | | | | | | | | | Package names have to be lowercase (debian-policy §5.6.1) and in as lowlevel as these method are it would be quiet strange to treat an invalid package "suddently" as a valid one which other tools might or might not accept. If case-insensitivity is really needed the frontend should ensure this rather than these methods waste cpu cycles by default. Git-Dch: Ignore
* deprecate Pkg->Name in favor of Grp->NameDavid Kalnischkies2014-09-274-11/+18
| | | | | | | They both store the same information, so this field just takes up space in the Package struct for no good reason. We mark it "just" as deprecated instead of instantly removing it though as it isn't misleading like Section was and is potentially used in the wild more often.
* Remove check for "Translation-" from pkgAcqIndex::Custom600Headers()Michael Vogt2014-09-251-4/+1
| | | | | This unneeded because pkgAcqIndexTrans has its own Custom600Headers() method.
* Revert making pkgAcquire::Item::DescURI() "const"Michael Vogt2014-09-251-12/+12
| | | | | | Revert because its a API change and the gain does not justify the extra work to make the required changes in the consumers of this interface at this point.
* DropPrivs: Document what it doesJulian Andres Klode2014-09-241-1/+11
| | | | Git-Dch: ignore
* DropPrivs: Use APT::Sandbox::User instead of Apt::User::NobodyJulian Andres Klode2014-09-241-3/+3
| | | | Git-Dch: ignore
* DropPrivs: Hard-fail if the user does not existJulian Andres Klode2014-09-241-1/+1
| | | | Git-Dch: ignore
* DropPrivs: Add some comments for the more obscure setuid/setgid functionsJulian Andres Klode2014-09-241-0/+2
| | | | Git-Dch: ignore
* DropPrivs: Move the re-set uid/gid thing to the end of the functionJulian Andres Klode2014-09-241-7/+7
| | | | Git-Dch: ignore
* methods: Fail if we cannot drop privilegesJulian Andres Klode2014-09-242-1/+13
|
* DropPrivs: Improve commentsJulian Andres Klode2014-09-241-8/+7
| | | | Git-Dch: ignore
* DropPrivs: Also check for saved set-user-ID and set-group-IDJulian Andres Klode2014-09-241-0/+20
|
* DropPrivs: Do not use an invalid return check for setgroups()Julian Andres Klode2014-09-241-1/+1
| | | | | | setgroups() returns 0 on success Git-Dch: ignore
* Use _apt as our unprivileged user nameJulian Andres Klode2014-09-241-1/+1
| | | | | | | Some people want to standardize on it, and BSDs do it too, so let's do the same. Reported-by: Paul Wise <pabs@debian.org>
* DropPriv: Really call seteuid and not setuid, and add more checksJulian Andres Klode2014-09-241-11/+35
| | | | The only thing we are missing is non-portable saved ids support.
* Drop Privileges to "Debian-apt" in most acquire methodsMichael Vogt2014-09-241-1/+33
| | | | | | | | | Add a new "Debian-apt" user that owns the /var/lib/apt/lists and /var/cache/apt/archive directories. The methods http, https, ftp, gpgv, gzip switch to this user when they start. Thanks to Julian and "ioerror" and tors "switch_id()" code.
* fix testsMichael Vogt2014-09-231-1/+1
|
* Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-238-127/+265
|\ | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc apt-pkg/acquire-item.h apt-pkg/cachefilter.h configure.ac debian/changelog
| * Ensure that iTFRewritePackageOrder is "MD5sum" to match apt-ftparchiveMichael Vogt2014-09-211-1/+1
| | | | | | | | | | | | | | The iTFRewritePackageOrder is used in indexcopy to copy and normalize cdrom Packages files. This change will ensure that there is no "normalization" that changes MD5sum -> MD5Sum which alters the hash of the Packages file on disk (oh the irony).
| * Fix regression for cdrom: sources from latest security updateMichael Vogt2014-09-211-0/+6
| | | | | | | | | | | | | | | | | | | | Skip a reverify for cdrom: sources. The reverify step is actually harmful here because the apt-cdrom add code uses the indexcopy.cc which will "normalize" the Packages file from the cdrom when it writes it to the local disk. This leads to changing the "MD5sum" field (notice the lower case "s") on the cdrom Packages file to a "MD5Sum" field on the local file in /var/lib/apt/lists. Which of course alters the hash and makes apt fail to reverify the file.
| * improve test for commit daff4aMichael Vogt2014-09-171-2/+3
| |
| * Fix regression for file:/// uris from CVE-2014-0487Michael Vogt2014-09-171-12/+6
| | | | | | | | | | | | | | | | Do not run ReverifyAfterIMS() for local file URIs as this will causes apt to mess around in the file:/// uri space. This is wrong in itself, but it will also cause a incorrect verification failure when the archive and the lists directory are on different partitions as rename().
| * SECURITY UPDATE for CVE-2014-{0488,0487,0489}Michael Vogt2014-09-163-22/+85
| | | | | | | | | | | | incorrect invalidating of unauthenticated data (CVE-2014-0488) incorect verification of 304 reply (CVE-2014-0487) incorrect verification of Acquire::Gzip indexes (CVE-2014-0489)
| * Allow override of Proxy-Auto-Detect by the users configurationMichael Vogt2014-09-121-0/+4
| | | | | | | | | | | | | | Only run the Proxy-Auto-Detect code if there is not already a host specific configuration. Closes: 759264
| * rework PTY magic to fix stair-stepping on kfreebsdDavid Kalnischkies2014-09-082-53/+107
| | | | | | | | | | | | | | | | | | | | | | | | A pty slave we have got from openpty can only be used for one dpkg child, if we give it to a second child on kfreebsd setting TIOCSCTTY fails causing the output to be stair-stepped from now on. By switching the code to creating a master and opening a new slave in the child for each child we can fix this glitch, so that at least the master remains stable. Closes: 759684
| * fix progress report for upgrade and reinstallDavid Kalnischkies2014-09-081-38/+41
| | | | | | | | | | | | | | | | | | | | | | APT treats upgrades like installs and dpkg is very similar in this, but prints still a slightly different processing message indicating that it is really an upgrade which we hadn't parsed so far, but this wasn't really visible as we quickly moved on to a 'known' state. More problematic was the reinstall case as apt hadn't recognized this for the package name detection, so that reinstalls had no progress since we introduced MultiArch.
| * strip everything spacey in APT::String::StripDavid Kalnischkies2014-09-071-6/+18
| | | | | | | | Git-Dch: Ignore
| * make GetLocalitySortedVersionSet more genericDavid Kalnischkies2014-09-071-0/+1
| | | | | | | | | | | | | | | | | | No reason in and of by itself at the moment, but prepares for the goal of having 'apt search' and 'apt-cache search' using the same code now that they at least support the same stuff. The 'apt' code is just a multitude slower at the moment… Git-Dch: Ignore
* | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-09-059-15/+168
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: apt-pkg/acquire-item.cc configure.ac debian/changelog doc/apt-verbatim.ent doc/po/apt-doc.pot doc/po/de.po doc/po/es.po doc/po/fr.po doc/po/it.po doc/po/ja.po doc/po/pt.po po/ar.po po/ast.po po/bg.po po/bs.po po/ca.po po/cs.po po/cy.po po/da.po po/de.po po/dz.po po/el.po po/es.po po/eu.po po/fi.po po/fr.po po/gl.po po/hu.po po/it.po po/ja.po po/km.po po/ko.po po/ku.po po/lt.po po/mr.po po/nb.po po/ne.po po/nl.po po/nn.po po/pl.po po/pt.po po/pt_BR.po po/ro.po po/ru.po po/sk.po po/sl.po po/sv.po po/th.po po/tl.po po/tr.po po/uk.po po/vi.po po/zh_CN.po po/zh_TW.po test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
| * Ensure we have a Policy in CacheFile.BuildDepCache()Michael Vogt2014-09-051-0/+3
| | | | | | | | | | | | This partly reverts d059cc2 and fixes bug #753297 in a more general way by ensuring that CacheFile.BuildDepCache() builds a pkgPolicy if there isn't one already.
| * * apt-pkg/deb/dpkgpm.cc:Michael Vogt2014-09-021-6/+7
| | | | | | | | | | | | | | - update string matching for dpkg I/O errors. (LP: #1363257) - properly parse the dpkg status line so that package name is properly set and an apport report is created. Thanks to Anders Kaseorg for the patch. (LP: #1353171)
| * Make Proxy-Auto-Detect check for each hostMichael Vogt2014-09-022-0/+98
| | | | | | | | | | | | | | | | | | When doing Acquire::http{,s}::Proxy-Auto-Detect, run the auto-detect command for each host instead of only once. This should make using "proxy" from libproxy-tools feasible which can then be used for PAC style or other proxy configurations. Closes: #759264
| * initialize iPolicyBrokenCount in DepCache::UpdateWarren He2014-08-291-1/+2
| | | | | | | | | | | | | | | | All other counters are correctly initialized here, expect this one. The practical effect is low as in apt we usually just do "!= 0" checks, but only correct counters are good counters. Closes: 758397
| * support versioned provides as implemented by dpkgDavid Kalnischkies2014-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | APT supported versioned provides for a long while in an attempt to get it working with rpm. While this support is old, we can be relatively sure that it works as versioned provides are used internally to make Multi-Arch:foreign work. Previous versions of apt will print a warning indicating that the versioned provides is ignored, so that something which "Provides: foo (= 2)" doesn't provide anything. Note that dpkg does allow only a equals-relation in the provides line as anything else is deemed too complex. apt doesn't support anything else either and such a support would require potentially big changes. Closes: 758153
| * Fix debListParser to accept "no" as a value for the Multi-Arch fieldJulian Andres Klode2014-08-241-1/+1
| | | | | | | | | | | | Seems this was missed somehow. Closes: #759099
| * Fix SmartConfigure to ignore ordering of packages that are already validMichael Vogt2014-07-291-1/+48
| | | | | | | | | | | | | | | | | | | | With the change of SmartConfigure() in git commit 42d51f the ordering code was trying to re-order dependencies, even when at this point in time this was not needed. Now it will first check all targets of the given dependency and only if there is not a good one try to reorder and unpack/configure as needed. Closes: LP: #1347721
| * apt-pkg/acquire-item.cc: make pkgAcqDiffIndex more uniformMichael Vogt2014-07-171-2/+2
| |
| * StringToBool: only act if the entire string is consumed by strtol()Michael Vogt2014-07-161-3/+6
| | | | | | | | | | | | | | | | | | StringToBool uses strtol() internally to check if the argument is a number. This function stops when it does not find any more numbers. So a string like "0ad" (which is a valid packagename) is interpreted as a "0". The code now checks that the entire string is consumed not just a part of it. Thanks to Johannes Schauer for raising this issue.
* | Fix debListParser to accept "no" as a value for the Multi-Arch fieldJulian Andres Klode2014-08-241-1/+1
| | | | | | | | | | | | Seems this was missed somehow. Closes: #759099
* | Do not crash for apt-get install /dev/nullMichael Vogt2014-07-161-0/+2
| | | | | | | | | | | | Thanks to Jakub Wilk for the bugreport. Closes: #754904
* | Allow passing a full path to apt-get install /foo/bar.debMichael Vogt2014-07-102-10/+27
| | | | | | | | CLoses: #752327
* | Only allow "apt-get build-dep path" when path starts with ./ or /Michael Vogt2014-07-082-0/+8
| | | | | | | | | | | | This avoid the subtle problem that someone might have a directory with the same package name as the build-depends he/she is trying to fetch. Also print a note that the specific file/dir is used.