summaryrefslogtreecommitdiff
path: root/apt-pkg
Commit message (Collapse)AuthorAgeFilesLines
* do not make PTY slave the controlling terminalDavid Kalnischkies2014-12-101-2/+2
| | | | | | | | | | | | | | | | | | | If we have no controlling terminal opening a terminal will make this terminal our controller, which is a serious problem if this happens to be the pseudo terminal we created to run dpkg in as we will close this terminal at the end hanging ourself up in the process… The offending open is the one we do to have at least one slave fd open all the time, but for good measure, we apply the flag also to the slave fd opening in the child process as we set the controlling terminal explicitely here. This is a regression from 150bdc9ca5d656f9fba94d37c5f4f183b02bd746 with the slight twist that this usecase was silently broken before in that it wasn't logging the output in term.log (as a pseudo terminal wasn't created). Closes: 772641
* always run 'dpkg --configure -a' at the end of our dpkg callingsDavid Kalnischkies2014-12-071-2/+7
| | | | | | | | | | | | | | | | | | | | | dpkg checks now for dependencies before running triggers, so that packages can now end up in trigger states (especially those we are not touching at all with our calls) after apt is done running. The solution to this is trivial: Just tell dpkg to configure everything after we have (supposely) configured everything already. In the worst case this means dpkg will have to run a bunch of triggers, usually it will just do nothing though. The code to make this happen was already available, so we just flip a config option here to cause it to be run. This way we can keep pretending that triggers are an implementation detail of dpkg. --triggers-only would supposely work as well, but --configure is more robust in regards to future changes to dpkg and something we will hopefully make use of in future versions anyway (as it was planed at the time this and related options were implemented). Closes: 769609
* correct architecture detection for 'rc' packages for purgeDavid Kalnischkies2014-12-071-12/+4
| | | | | | | | | We were already considering these cases, but the code was flawed, so that packages changing architectures are incorrectly handled and hence the wrong architecture is used to call dpkg with, so that dpkg says the package isn't installed (which it isn't for the requested architecture). Closes: 770898
* properly handle already reinstall pkgs in orderingDavid Kalnischkies2014-12-071-10/+36
| | | | | | | | | | | The bugreport itself describes the case of the ordering code detecting a loop where none is present, but the testcase finds also cases in which there is actually a loop and we fail to realize it. --reinstall can be considered an interactive command through and it usually doesn't encounter such "hard" problems (= looping essentials), so this is less serious than it sounds at first. Closes: 770291
* fix PTY interaction on linux and kfreebsdDavid Kalnischkies2014-11-191-44/+55
| | | | | | | | | | | | | | | | | | | | | | | | | We run dpkg on its own pty, so we can log its output and have our own output around it (like the progress bar), while also allowing debconf and configfile prompts to happen. In commit 223ae57d468fdcac451209a095047a07a5698212 we changed to constantly reopening the slave for kfreebsd. This has the sideeffect though that in some cases slave and master will lose their connection on linux, so that no output is passed along anymore. We fix this by having always an fd referencing the slave open (linux), but we don't use it (kfreebsd). Failing to get our PTY up and running has many (bad) consequences including (not limited to, nor all at ones or in any case) garbled ouput, no output, no logging, a (partial) mixture of the previous items, … This commit is therefore also reshuffling quiet a bit of the creation code to get especially the output part up and running on linux and the logging for kfreebsd. Note that the testcase tries to cover some cases, but this is an interactivity issue so only interactive usage can really be a good test. Closes: 765687
* close leaking slave fd after setting up pty magicDavid Kalnischkies2014-11-181-2/+4
| | | | | | | The fd moves out of scope here anyway, so we should close it properly instead of leaking it which will tickle down to dpkg maintainer scripts. Closes: 767774
* create our cache and lib directory always with mode 755David Kalnischkies2014-11-182-4/+10
| | | | | | | | | | | | | We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable.
* create directory for extended_states if neededDavid Kalnischkies2014-11-181-1/+3
| | | | | Unlikely perhaps, but there is no guarantee that the directory we want to drop the file into actually exists, so create it if we must.
* use pkgAcquire::GetLock instead of own codeDavid Kalnischkies2014-11-091-0/+2
| | | | | | | | | Do the same with less code in apt-get. This especially ensures that the lock file (and the parent directories) exist before we are trying to lock. It also means that clean now creates the directories if they are missing so we returned to a proper clean state now. Git-Dch: Ignore
* streamline display of --help in all toolsDavid Kalnischkies2014-11-092-0/+4
| | | | | | | By convention, if I run a tool with --help or --version I expect it to exit successfully with the usage, while if I do call it wrong (like without any parameters) I expect the usage message shown with a non-zero exit.
* fix variable naming typo used in debug outputDavid Kalnischkies2014-11-081-5/+5
| | | | Git-Dch: Ignore
* restore ABI of pkgTagSectionDavid Kalnischkies2014-11-082-43/+86
| | | | | | | | We have a d-pointer available here, so go ahead and use it which also helps in hidding some dirty details here. The "hard" part is keeping the abi for the inlined methods so that they don't break – at least not more than before as much of the point beside a speedup is support for more than 256 fields in a single section.
* revert useless abibreak in sourceslist.hDavid Kalnischkies2014-11-081-14/+10
| | | | | | | | No idea what the intension was here, but it seems like a leftover from a workover which happened to be done differently later. As it doesn't provide anything at the moment we just revert to the previous abi here. Git-Dch: Ignore
* guard pkg/grp hashtable creation changesDavid Kalnischkies2014-11-083-40/+110
| | | | | | | | | The change itself is no problem ABI wise, but the remove of the old undynamic hashtables is, so we bring it back for older abis and happily use the now available free space to backport more recent additions like the dynamic hashtable itself. Git-Dch: Ignore
* explicit overload methods instead of adding parametersDavid Kalnischkies2014-11-0811-9/+93
| | | | | | | | Adding a new parameter (with a default) is an ABI break, but you can overload a method, which is "just" an API break for everyone doing references to this method (aka: nobody). Git-Dch: Ignore
* guard const-ification API changesDavid Kalnischkies2014-11-086-1/+85
| | | | Git-Dch: Ignore
* guard ABI changes for SourcePkg/Ver in pkgCacheDavid Kalnischkies2014-11-085-1/+23
| | | | Git-Dch: Ignore
* mark internal interfaces as hiddenDavid Kalnischkies2014-11-0816-78/+72
| | | | | | | We have a bunch of classes which are of no use for the outside world, but were still exported and so needed to preserve ABI/API. Marking them as hidden to not export them any longer is a big API break in theory, but in practice nobody is using them – as if they would its a bug.
* better non-virtual metaIndex.LocalFileName() implementationDavid Kalnischkies2014-11-084-22/+48
| | | | | | | | We can't add a new virtual method without breaking the ABI, but we can freely add new methods, so for older ABIs we just implement this method with a dynamic_cast, so that clients can be more ignorant about the API here and especially don't need to pull a very dirty trick by assuming internal knowledge (like apt-get did here).
* use a abi version check similar to the gcc checkDavid Kalnischkies2014-11-089-16/+17
| | | | Git-Dch: Ignore
* replace ignore-deprecated #pragma dance with _PragmaDavid Kalnischkies2014-11-0813-236/+76
| | | | | | | | | For compatibility we use/provide and fill quiet some deprecated methods and fields, which subsequently earns us a warning for using them. These warnings therefore have to be disabled for these codeparts and that is what this change does now in a slightly more elegant way. Git-Dch: Ignore
* (error) va_list 'args' was opened but not closed by va_end()David Kalnischkies2014-11-081-4/+8
| | | | | | | | | | | | | The manpage of va_start and co additionally says: On some systems, va_end contains a closing '}' matching a '{' in va_start, so that both macros must occur in the same function, and in a way that allows this. So instead of return/breaking instantly, we save the return, make a proper turndown with va_end in all cases and only end after that. Reported-By: cppcheck Git-Dch: Ignore
* reenable patchsize limit option for pdiffsDavid Kalnischkies2014-11-081-1/+1
| | | | | | | | One word: "doh!" Commit f6d4ab9ad8a2cfe52737ab620dd252cf8ceec43d disabled the check to prevent apt from downloading bigger patches than the index it tries to patch. Happens rarly of course, but still. Detected by scan-build complaining about a dead assignment. To make up for the mistake a test is included as well.
* Merge remote-tracking branch 'mvo/feature/no-more-acquire-guessing' into ↵Michael Vogt2014-11-064-166/+43
|\ | | | | | | debian/experimental
| * Merge remote-tracking branch 'upstream/debian/experimental' into ↵Michael Vogt2014-11-069-157/+210
| |\ | | | | | | | | | | | | | | | | | | feature/no-more-acquire-guessing Conflicts: apt-pkg/acquire-item.cc
| * | apt-pkg/deb/debindexfile.{cc,h}: kill GetIndexes()Michael Vogt2014-11-052-14/+0
| | |
| * | Only support Translation-* that are listed in the {In,}Release fileMichael Vogt2014-10-293-155/+44
| | | | | | | | | | | | | | | | | | | | | | | | Handle Translation-* files exactly like Packages files (with the expection that it is ok if a download of them fails). Remove all "guessing" on apts side. This will elimimnate a bunch of errors releated to captive portals and similar. Its also more correct and removes another potential attack vector.
* | | Bump ABI to 4.15Michael Vogt2014-11-051-1/+1
| | |
* | | prepare ABI for feature/socketpairMichael Vogt2014-11-052-0/+6
| | |
* | | Merge branch 'debian/sid' into debian/experimentalMichael Vogt2014-11-051-2/+21
|\ \ \ | |_|/ |/| | | | | | | | Conflicts: debian/changelog
| * | Fix incorrect comparison between signed/unsignedMichael Vogt2014-10-231-1/+1
| | | | | | | | | | | | Git-Dch: ignore
| * | Use sysconf(_SC_ARG_MAX) to find the size of Dpkg::MaxArgBytesMichael Vogt2014-10-231-2/+21
| | | | | | | | | | | | | | | Instead of hardcoding Dpkg::MaxArgBytes find out about it using the sysconf(_SC_ARG_MAX) call.
* | | apt-pkg/acquire-item.h: make friend declaration compatible with older gccMichael Vogt2014-11-041-1/+1
| | |
* | | Call "Dequeue()" for items in AbortTransaction() to fix raceMichael Vogt2014-11-042-0/+5
| | | | | | | | | | | | | | | | | | The pkgAcquire::Run() code works uses a while(ToFetch > 0) loop over the items queued for fetching. This means that we need to Deqeueue the item if we call AbortTransaction() to avoid a hang.
* | | move permission changing from -item to -workerDavid Kalnischkies2014-10-262-45/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The worker is the part closest to the methods, which will call the item methods according to what it gets back from the methods, it is therefore a better place to change permissions as it is very central and can do it now at the point the item is assigned to a method rather than then it is queued for download (and as before while dequeued via Done/Failure). Git-Dch: Ignore
* | | rewrite ReadMessages()David Kalnischkies2014-10-261-58/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Central methods of our infrastructure like this one responsible for communication with our methods shouldn't be more complicated then they have to and not claim to have (albeit unlikely) bugs. While I am not sure about having improved the first part, the bug is now gone and a few explicit tests check that it stays that way, so nobody will notice the difference (hopefully) – expect that this should a very tiny bit faster as well as we don't manually proceed through the string. Git-Dch: Ignore
* | | promote filesize to a hashstringDavid Kalnischkies2014-10-243-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is a very simple hashstring, which is why it isn't contributing to the usability of a list of them, but it is also trivial to check and calculate, so it doesn't hurt checking it either as it can combined even with the simplest other hashes greatly complicate attacks on them as you suddenly need a same-size hash collision, which is usually a lot harder to achieve.
* | | chown finished partial files earlierDavid Kalnischkies2014-10-234-65/+89
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partial files are chowned by the Item baseclass to let the methods work with them. Now, this baseclass is also responsible for chowning the files back to root instead of having various deeper levels do this. The consequence is that all overloaded Failed() methods now call the Item::Failed base as their first step. The same is done for Done(). The effect is that even in partial files usually don't belong to _apt anymore, helping sneakernets and reducing possibilities of a bad method modifying files not belonging to them. The change is supported by the framework not only supporting being run as root, but with proper permission management, too, so that privilege dropping can be tested with them.
* | check that auth.conf exists before chowning itDavid Kalnischkies2014-10-221-3/+4
| | | | | | | | Git-Dch: Ignore
* | Ensure /etc/apt/auth.conf has _apt:root ownerMichael Vogt2014-10-211-2/+10
| | | | | | | | | | Ensure in SetupAPTPartialDirectory() that the /etc/apt/auth.conf file can be read by the priv sep apt methods.
* | test if TMPDIR is accessible before usingDavid Kalnischkies2014-10-201-2/+4
| | | | | | | | | | | | | | | | | | | | Private temporary directories as created by e.g. libpam-tmpdir are nice, but they are also very effective in preventing our priviledge dropping to work as TMPDIR will be set to a directory only root has access to, so working with it as _apt will fail. We circumvent this by extending our check for a usable TMPDIR setting by checking access rights. Closes: 765951
* | check for failure message in testsuccess/failureDavid Kalnischkies2014-10-201-1/+1
| | | | | | | | | | | | | | | | These functions check the exit code of the command, but for apt commands we can go further and require an error message for non-zero exits and none for zero exits. Git-Dch: Ignore
* | use c++ style instead of the last two c-arraysDavid Kalnischkies2014-10-201-21/+21
| | | | | | | | Git-Dch: Ignore
* | aborted reverify restores file owner and permissionDavid Kalnischkies2014-10-201-1/+5
| | | | | | | | | | | | | | | | | | | | If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files.
* | run acquire transactions only onceDavid Kalnischkies2014-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | Transactions are run and completed from multiple places, so it happens for unsigned repos that the Release file was commited even if it was previously aborted (due to --no-allow-insecure-repositories). The reason is simply that the "failure" of getting an InRelease/Release.gpg is currently ignored, so that the acquire process believes that nothing bad happened and commits the transaction even though the same transaction was previously aborted.
* | mark --allow-insecure-repositories message as translateableDavid Kalnischkies2014-10-201-18/+15
| | | | | | | | | | | | | | Refactors a bit to ensure the same message is used in all three cases as well. Git-Dch: Ignore
* | ignore Acquire::GzipIndexes for cdrom sourcesDavid Kalnischkies2014-10-151-20/+27
| | | | | | | | | | | | We do not support compressed indexes for cdrom sources as we rewrite some of them, so supporting it correctly could be hard. What we do instead in the meantime is probably disabling it for cdrom sources.
* | Merge branch 'debian/sid' into debian/experimentalDavid Kalnischkies2014-10-151-5/+5
|\| | | | | | | | | | | | | | | The acquire code changed completely, so this is more an import of the testcase and a new fix than the merge of an existent fix. Conflicts: apt-pkg/acquire-item.cc
| * don't cleanup cdrom files in apt-get updateDavid Kalnischkies2014-10-151-8/+7
| | | | | | | | | | | | | | | | | | | | Regression from merging 801745284905e7962aa77a9f37a6b4e7fcdc19d0 and b0f4b486e6850c5f98520ccf19da71d0ed748ae4. While fine by itself, merged the part fixing the filename is skipped if a cdrom source is encountered, so that our list-cleanup removes what seems to be orphaned files. Closes: 765458
* | set PR_SET_NO_NEW_PRIVS even if sandbox is disabledDavid Kalnischkies2014-10-151-6/+6
| | | | | | | | | | | | | | Similar to 8f45798d532223adc378a4ad9ecfc64b3be26e4f, there is no harm to set this, even if we don't drop privileges. Git-Dch: Ignore