summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/dpkgpm.cc
AgeCommit message (Collapse)Author
2015-04-07fix crash in order writing in pkgDPkgPM::WriteApportReport()Michael Vogt
libapt can be configured to write various bits of information to a file creating a report via apport. This is disabled by default in Debian and apport residing only in /experimental so far, but Ubuntu and other derivatives have this (in some versions) enabled by default and there is no regression potentially here. The crash is caused by a mismatch of operations vs. strings for operations, so adding the missing strings for these operations solves the problem. [commit message by David Kalnischkies] LP: #1436626
2014-12-23pass-through stdin fd instead of content if not a terminalDavid Kalnischkies
Commit 299aea924ccef428219ed6f1a026c122678429e6 fixes the problem of not logging terminal in case stdin & stdout are not a terminal. The problem is that we are then trying to pass-through stdin content by reading from the apt-process stdin and writing it to the stdin of the child (dpkg), which works great for users who can control themselves, but pipes and co are a bit less forgiving causing us to pass everything to the first child process, which if the sending part of the pipe is e.g. 'yes' we will never see the end of it (as the pipe is full at some point and further writing blocks). There is a simple solution for that of course: If stdin isn't a terminal, we us the apt-process stdin as stdin for the child directly (We don't do this if it is a terminal to be able to save the typed input in the log). Closes: 773061
2014-12-23always run 'dpkg --configure -a' at the end of our dpkg callingsDavid Kalnischkies
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). Note that dpkg currently has a workaround implemented to allow upgrades to jessie to be clean, so that the test works before and after. Also note that test (compared to the one in the bug) drops the await test as its is considered a loop by dpkg now. Closes: 769609
2014-12-23do not make PTY slave the controlling terminalDavid Kalnischkies
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
2014-11-28fix PTY interaction on linux and kfreebsdDavid Kalnischkies
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
2014-11-28close leaking slave fd after setting up pty magicDavid Kalnischkies
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
2014-10-23Fix incorrect comparison between signed/unsignedMichael Vogt
Git-Dch: ignore
2014-10-23Use sysconf(_SC_ARG_MAX) to find the size of Dpkg::MaxArgBytesMichael Vogt
Instead of hardcoding Dpkg::MaxArgBytes find out about it using the sysconf(_SC_ARG_MAX) call.
2014-09-08rework PTY magic to fix stair-stepping on kfreebsdDavid Kalnischkies
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
2014-09-08fix progress report for upgrade and reinstallDavid Kalnischkies
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.
2014-09-02* apt-pkg/deb/dpkgpm.cc:Michael Vogt
- 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)
2014-05-28Fix warning about uninitialized variableMichael Vogt
Reported-By: clang++ -Werror
2014-04-30Only do openpty() if both stdin/stdout are terminalsMichael Vogt
Closes: 746434
2014-04-25reduce delta from ubuntuMichael Vogt
2014-04-01do not crash on SIGPIPE in pkgDPkgPM::RunScriptsWithPkgs()Michael Vogt
If a external command closes the PIPE unexpectedly, do not crash in pkgDPkgPM::RunScriptsWithPkgs but ignore the SIGPIPE.
2014-04-01Add new Debug::RunScripts optionMichael Vogt
This debug option will display all scripts that are run by apts RunScripts and RunScriptsWithPkgs helpers.
2014-03-22ensure proper teardown in dpkg error casesDavid Kalnischkies
We have to properly close our pseudo terminals even in error cases before we call post-invoke scripts. This is done now by breaking from the dpkg calling loop instead of copying the handling, which did it in the wrong order before. This also ensures that our state file is written in error cases to record autobit and co as this was forgotten before. Closes: 738969
2014-03-13cleanup headers and especially #includes everywhereDavid Kalnischkies
Beside being a bit cleaner it hopefully also resolves oddball problems I have with high levels of parallel jobs. Git-Dch: Ignore Reported-By: iwyu (include-what-you-use)
2014-03-13warning: unused parameter ‘foo’ [-Wunused-parameter]David Kalnischkies
Reported-By: gcc -Wunused-parameter Git-Dch: Ignore
2014-01-26Merge remote-tracking branch 'donkult/debian/sid' into debian/sidMichael Vogt
Conflicts: apt-private/private-list.cc doc/po/de.po test/integration/framework
2014-01-18do not ignore ioctl(TIOCSCTTY) errorsMichael Vogt
Show a proper error message when a ioctl() in dpkgpm.cc fails. Also simply StartPtyMagic() a bit.
2014-01-16correct some style/performance/warnings from cppcheckDavid Kalnischkies
The most "visible" change is from utime to utimensat/futimens as the first one isn't part of POSIX anymore. Reported-By: cppcheck Git-Dch: Ignore
2013-12-28Merge branch 'debian/sid' into bugfix/bts731738-fancy-progessMichael Vogt
Conflicts: apt-pkg/install-progress.cc
2013-12-22first proof-of-concept for a fix for #731738Michael Vogt
2013-12-12Fix conffile prompt regression (LP: #1260297)Michael Vogt
This fixes a regression in the conffile prompt for the progress-fd and adds a testcase to ensure this does not regress again.
2013-11-30merge ubuntus apport reporting changes to reduce diffDavid Kalnischkies
apport reporting is still disabled by default, but it is available in Debian/experimental at the moment and a diff is not a good idea anyway.
2013-11-29fix apport report writing (LP: #1254499)Michael Vogt
2013-11-29reset terminal on error (closes: #730795)Michael Vogt
2013-11-28fix regression that APT::Keep-Fds is not honored (closes: #730490)Michael Vogt
2013-10-31add new pid_t ExecFork(std::set<int> KeepFDs) to get rid of the super ugly ↵Michael Vogt
APT::Keep-Fds hack and also add a new PackageManagerProgressFd::StartDpkg() progress state
2013-10-31move pty magic into its own functionsMichael Vogt
2013-10-31restore ABI and prepare next ABI via #if (APT_PKG_MAJOR >= 4 && ↵Michael Vogt
APT_PKG_MINOR >= 13)
2013-10-31move pty stuff into its own functionMichael Vogt
2013-10-25extract getDpkgExecutable() and DPkgPM::BuildPackagesProgressMap() out of ↵Michael Vogt
the monster long pkgDPkgPM::Go()
2013-10-24make the main loop a while() instead of a for() as I find this (much) easier ↵Michael Vogt
to read this way)
2013-10-22fix failing ./test/integration/test-disappearing-packages (thanks Donkult!)Michael Vogt
2013-10-22use Pkg.FullName() in disappearedPkgs and remove duplicated checkMichael Vogt
2013-10-22fix install-progress locationMichael Vogt
2013-10-21restore binary compatiblity with the pkgPackageManager interfaceMichael Vogt
2013-10-21fix apt output ordering and update test to match the new human friendly ↵Michael Vogt
messages that include the architecture
2013-10-18re-add missing APT::String::StripMichael Vogt
2013-10-18merged debian/sidMichael Vogt
2013-10-18use std::string instead of char* in pkgDPkgPM::ProcessDpkgStatusLine()Michael Vogt
2013-10-18reshuffle the pkgDPkgPM::ProcessDpkgStatusLine() some more to make it more ↵Michael Vogt
robust
2013-10-18reshuffle dpkgpm.cc code a bit moreMichael Vogt
2013-10-18add APT::String::Strip(), start cleanup of ProcessDpkgStatusLineMichael Vogt
2013-10-18cleanupMichael Vogt
2013-10-17ensure that short-name -> long-name detection for dpkg-status works for ↵Michael Vogt
reinstalls too
2013-10-17Merge branch 'debian/sid' into feature/install-progress-refactorMichael Vogt
Conflicts: apt-pkg/deb/dpkgpm.cc
2013-10-17fix broken clean when apt was finished and ensure that terminal progress is ↵Michael Vogt
updated when a new dpkg-loop is entered in dpkgpm.cc