summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debsystem.cc
Commit message (Collapse)AuthorAgeFilesLines
* Show absolute time while waiting for lock instead of %, rework messageJulian Andres Klode2020-03-061-1/+6
| | | | | | | | | | | | | | | | | | | | | Showing a percentage for a timeout is pretty non-standard. Rework the progress class so it can show an absolute progress (currently hardcoded to use seconds as a unit). If there is a timeout (aka if it's not the maximum long long unsigned -1llu), then show the timeout, otherwise just count up seconds, e.g. Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 33842 (apt)... 1/120s or Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 33842 (apt)... 1s Also improve the error message to use "Waiting for cache lock: %s" instead of "... (%s)", as having multiple sentences inside parenthesis is super weird, as is having two closing parens. We pass the information via _config, as that's reasonably easy and avoids ABI hackage. It also provides an interesting debugging tool for other kinds of progress.
* apt(8): Wait for frontend and cache lockJulian Andres Klode2020-02-261-5/+45
| | | | | | This is a rework of !6 with additional stuff for the frontend lock, so we can lock the frontend lock and then keep looping over dpkg lock.
* pkgsystem: Drop more virtual workaround shenanigansJulian Andres Klode2020-02-261-2/+2
|
* Unlock dpkg locks in reverse locking orderJulian Andres Klode2019-05-211-1/+1
| | | | | | | We need to unlock in the reverse order of locking in order to get useful behavior. LP: #1829860
* Set PATH=/usr/sbin:/usr/bin:/sbin:/bin when running dpkgJulian Andres Klode2018-12-101-0/+4
| | | | | | | | | This avoids a lot of problems from local installations of scripting languages and other stuff in /usr/local for which maintainer scripts are not prepared. [v3: Inherit PATH during tests, check overrides work] [v2: Add testing]
* Set DPKG_FRONTEND_LOCKED as needed when doing selection changesJulian Andres Klode2018-08-081-0/+5
| | | | | | | We forgot to set the variable for the selection changes. Let's set it for that and some other dpkg calls. Regression-Of: c2c8b4787b0882234ba2772ec7513afbf97b563a
* Add support for dpkg frontend lockJulian Andres Klode2018-08-071-7/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The dpkg frontend lock is a lock dpkg tries to acquire except if the frontend already acquires it. This fixes a race condition in the install command where the dpkg lock is not held for a short period of time between different dpkg invocations. For this reason we also define an environment variable DPKG_FRONTEND_LOCKED for dpkg invocations so dpkg knows not to try to acquire the frontend lock because it's held by a parent process. We can set DPKG_FRONTEND_LOCKED only if the frontend lock really is held; that is, if our lock count is greater than 0 - otherwise an apt client not using the LockInner family of functions would run dpkg without the frontend lock set, but with DPKG_FRONTEND_LOCKED set. Such a process has a weaker guarantee: Because dpkg would not lock the frontend lock either, the process is prone to the existing races, and, more importantly, so is a new style process. Closes: #869546 [fixups: fix error messages, add public IsLocked() method, and make {Un,}LockInner return an error on !debSystem]
* Fix lock counting in debSystemJulian Andres Klode2018-06-131-1/+1
| | | | | | | | | | | | | | | debSystem uses a reference counted lock, so you can acquire it multiple times in your applications, possibly nested. Nesting locks causes a fd leak, though, as we only increment the lock count when we already have locked twice, rather than once, and hence when we call lock the second time, instead of increasing the lock count, we open another lock fd. This fixes the code to check if we have locked at all (> 0). There is no practical problem here aside from the fd leak, as closing the new fd releases the lock on the old one due to the weird semantics of fcntl locks.
* Remove obsolete RCS keywordsGuillem Jover2018-05-071-1/+0
| | | | Prompted-by: Jakub Wilk <jwilk@debian.org>
* Reformat and sort all includes with clang-formatJulian Andres Klode2017-07-121-8/+8
| | | | | | | | | | | | | This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
* Drop cacheiterators.h includeJulian Andres Klode2017-07-121-1/+0
| | | | | Including cacheiterators.h before pkgcache.h fails because pkgcache.h depends on cacheiterators.h.
* Make directory paths configurableJulian Andres Klode2016-08-261-4/+4
| | | | | | | This allows other vendors to use different paths, or to build your own APT in /opt for testing. Note that this uses + 1 in some places, as the paths we receive are absolute, but we need to strip of the initial /.
* default to Dir=/ in dpkg/status file finding magicDavid Kalnischkies2016-08-171-12/+10
| | | | | | | | | | | | | Seen in cme #833656 if Dir isn't set (yet) we end up later absoluting a path which was supposed to be absolute already, so if Dir is empty we assume it to be '/' instead. In practice this is a bug in the software using libapt, but for maxium compatibility lets explicitly set the default value here to be safe. Reported-By: Paul Wise <pabs@debian.org> Inspired-By: Brendan O'Dea <bod@debian.org> Fixes-Regression: 475f75506db48a7fa90711fce4ed129f6a14cc9a Shadows-Bug: #833656
* don't hardcode /var/lib/dpkg/status as dir::state::statusDavid Kalnischkies2016-07-191-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Theoretically it should be enough to change the Dir setting and have apt pick the dpkg/status file from that. Also, it should be consistently effected by RootDir. Both wasn't really the case through, so a user had to explicitly set it too (or ignore it and have or not have expected sideeffects caused by it). This commit tries to guess better the location of the dpkg/status file by setting dir::state::status to a naive "../dpkg/status", just that this setting would be interpreted as relative to the CWD and not relative to the dir::state directory. Also, the status file isn't really relative to the state files apt has in /var/lib/apt/ as evident if we consider that apt/ could be a symlink to someplace else and "../dpkg" not effected by it, so what we do here is an explicit replace on apt/ – similar to how we create directories if it ends in apt/ – with dpkg/. As this is a change it has the potential to cause regressions in so far as the dpkg/status file of the "host" system is no longer used if you set a "chroot" system via the Dir setting – but that tends to be intended and causes people to painfully figure out that they had to set this explicitly before, so that it now works more in terms of how the other Dir settings work (aka "as expected"). If using the host status file is really intended it is in fact easier to set this explicitely compared to setting the new "magic" location explicitely.
* don't use FindFile for external Dir::Bin commandsDavid Kalnischkies2016-06-141-1/+1
| | | | | | | | | | We usually use absolute paths to specific the location of dpkg, apt-key and the like, but there is nothing wrong with using just the command name and instead let exec(3) make the lookup in PATH. We had a wild mixture before, so opting for the more accepting option out of the two seems about right especially as it makes no difference in the default case as apt uses absolute paths.
* Convert most callers of isspace() to isspace_ascii()Julian Andres Klode2015-12-271-2/+2
| | | | | This converts all callers that read machine-generated data, callers that might work with user input are not converted.
* provide public interface to hold/unhold packagesDavid Kalnischkies2015-11-041-4/+4
| | | | | | 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.
* implement a public pkgSystem::ArchitecturesSupportedDavid Kalnischkies2015-11-041-1/+61
|
* implement a public pkgSystem::MultiArchSupportedDavid Kalnischkies2015-11-041-0/+93
| | | | | | 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.
* make all d-pointer * const pointersDavid Kalnischkies2015-08-101-4/+1
| | | | | | | | | | | | | | Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore
* mark internal interfaces as hiddenDavid Kalnischkies2014-11-081-1/+1
| | | | | | | 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.
* follow method attribute suggestions by gccDavid Kalnischkies2014-03-131-1/+1
| | | | | Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn}
* cleanup headers and especially #includes everywhereDavid Kalnischkies2014-03-131-1/+8
| | | | | | | | 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)
* Fix typos in documentation (codespell)Michael Vogt2014-02-221-1/+1
|
* do not pollute namespace in the headers with using (Closes: #500198)David Kalnischkies2011-09-191-1/+3
|
* reorder includes: add <config.h> if needed and include it at firstDavid Kalnischkies2011-09-131-1/+4
|
* apt-pkg/deb/debsystem.{cc,h}: add dpointerMichael Vogt2011-01-271-26/+36
|
* apt-pkg/deb/debsystem.cc: remove duplicated rootdir (FindFile will prepend ↵Michael Vogt2010-10-131-1/+1
| | | | the rootdir later anyway)
* * revert commit:Michael Vogt2010-10-131-1/+1
| | | | | | * apt-pkg/deb/debsystem.cc: - set dir::state::status based at least on dir This causes problems with alternative rootdirs
* * apt-pkg/deb/debsystem.cc:David Kalnischkies2010-08-191-1/+1
| | | - set dir::state::status based at least on dir
* merged from lp:~donkult/apt/sidMichael Vogt2010-06-091-1/+1
|\
| * * apt-pkg/deb/debsystem.cc:David Kalnischkies2010-05-281-1/+1
| | | | | | - add better config item for extended_states file
* | * merge the remaining Ubuntu change:Michael Vogt2010-06-091-2/+8
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - on gpg verification failure warn and restore the last known good state - on failure display the IP of the server (useful for servers that use round robin DNS) - support Original-Maintainer in RewritePackageOrder - enable cdrom autodetection via libudev by default - show messsage about Vcs in use when apt-get source is run for packages maintained in a Vcs - better support transitional packages with mark auto-installed. when the transitional package is in "oldlibs" the new package is not marked auto installed (same is true for section metapackages) - provide new "deb mirror://archive.foo/mirrors.list sid main" method expects a list of mirrors (generated on the server e.g. via geoip) and will use that, including cycle on failure - write apport crash file on package failure (disabled by default on debian until apport is available) - support mirror failure reporting (disabled by default on debian)
| * merged from the debian-sid branchMichael Vogt2009-06-091-1/+0
| |\
| * | merged from the mvo branchMichael Vogt2009-01-281-1/+1
| | |
| * | LP: #263089Michael Vogt2009-01-281-5/+5
| | |
| * | apt-pkg/deb/debsystem.cc: add missing apti18n.h headerMichael Vogt2008-12-081-0/+1
| | |
| * | make dpkg string translatableMichael Vogt2008-11-261-2/+2
| | |
| * | * /apt-pkg/deb/debsystem.cc:Michael Vogt2008-11-261-1/+1
| | | | | | | | | | | | - add 'sudo' to the error message to "run 'dpkg --configure -a'" (LP: #52697)
* | | * apt-pkg/acquire.cc:Michael Vogt2009-07-211-6/+6
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - make the max pipeline depth of the acquire queue configurable via Acquire::Max-Pipeline-Depth * apt-pkg/deb/dpkgpm.cc: - add Dpkg::UseIoNice boolean option to run dpkg with ionice -c3 (off by default) - send "dpkg-exec" message on the status fd when dpkg is run - provide DPkg::Chroot-Directory config option (useful for testing) - fix potential hang when in a backgroud process group * apt-pkg/algorithms.cc: - consider recommends when making the scores for the problem resolver * apt-pkg/acquire-worker.cc: - show error details of failed methods * apt-pkg/contrib/fileutl.cc: - if a process aborts with signal, show signal number * methods/http.cc: - ignore SIGPIPE, we deal with EPIPE from write in HttpMethod::ServerDie() (LP: #385144) * apt-pkg/indexcopy.cc: - support having CDs with no Packages file (just a Packages.gz) by not forcing a verification on non-existing files (LP: #255545) - remove the gettext from a string that consists entirely of variables (LP: #56792) * apt-pkg/cacheiterators.h: - add missing checks for Owner == 0 in end() * apt-pkg/indexrecords.cc: - fix some i18n issues * apt-pkg/contrib/strutl.h: - add new strprintf() function to make i18n strings easier - fix compiler warning * apt-pkg/deb/debsystem.cc: - make strings i18n able * fix problematic use of tolower() when calculating the version hash by using locale independant tolower_ascii() function. Thanks to M. Vefa Bicakci (LP: #80248) * build fixes for g++-4.4 * cmdline/apt-mark: - add "showauto" option to show automatically installed packages * document --install-recommends and --no-install-recommends (thanks to Dereck Wonnacott, LP: #126180) * Updated cron script to support backups by hardlinks and verbose levels. All features turned off by default. * Added more error handlings. Closes: #438803, #462734, #454989, * Refactored condition structure to make download and upgrade performed if only previous steps succeeded. Closes: #341970 * Documented all cron script related configuration items in configure-index. * apt-ftparchive might write corrupt Release files (LP: #46439) * Apply --important option to apt-cache depends (LP: #16947)
| * | apt-pkg/deb/debsystem.cc: add missing i18n stringMichael Vogt2009-01-281-1/+1
| | |
| * | * methods/gpgv.cc:Michael Vogt2008-12-091-7/+8
| |/ | | | | | | | | | | | | | | - fix compiler warning * cmdline/apt-get.cc: - fix "apt-get source pkg=ver" if binary name != source name and show a message (LP: #202219) * apt-pkg/deb/debsystem.cc: - make strings i18n able
* | build fixes, change version 0.7.21Michael Vogt2009-04-141-0/+1
| |
* | * apt-pkg/contrib/strutl.cc:Michael Vogt2009-04-091-1/+1
|/ | | | | | | | | | | | | | | | | | | - fix TimeToStr i18n (LP: #289807) * [ABI break] merge support for http redirects, thanks to Jeff Licquia and Anthony Towns * [ABI break] use int for the package IDs (thanks to Steve Cotton) * apt-pkg/pkgcache.cc: - do not run "dpkg --configure pkg" if pkg is in trigger-awaited state (LP: #322955) * methods/https.cc: - add Acquire::https::AllowRedirect support * Clarify the --help for 'purge' (LP: #243948) * cmdline/apt-get.cc - fix "apt-get source pkg" if there is a binary package and a source package of the same name but from different packages (LP: #330103) * cmdline/acqprogress.cc: - Call pkgAcquireStatus::Pulse even if quiet, so that we still get dlstatus messages on the status-fd (LP: #290234).
* * remove all the remaining #pragma implementationMichael Vogt2007-06-081-4/+0
|
* * merged with apt--fixes--0Michael Vogt2005-08-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patches applied: * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-7 * fixed incorrect man-page example * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-8 * changelog udpate * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-9 * we only need to check once for xmlto * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-10 * fix a bug in a man-page, fix a problem with overly long lines in apt-cdrom * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-11 * merged with apt--main--0 * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-12 * fix a incorrect error message (it always added .gz regardless what was downloaded) * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-13 * merged with main * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-14 * added Hashsum support for file and cdrom * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-15 * added README.arch * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-16 * merged with main * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-17 * move the changelog to the right place * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-18 * Change pkgPolicy::Pin from private to protected * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-19 * added a default constructor for PrvIterator * michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-20 * applied otavios patch to reread the statusFile on debSystem::Initialize * otavio@debian.org--2005/apt--fixes--0--patch-28 Reread status configuration, needed for clients using independent apt ...
* * Initialize StatusFile in debSystem (Closes: #229791)Arch Librarian2004-09-201-1/+2
| | | | | | Author: mdz Date: 2004-01-26 17:01:53 GMT * Initialize StatusFile in debSystem (Closes: #229791)
* 'apt-cache policy' preferences debug tool.Arch Librarian2004-09-201-2/+29
| | | | | | Author: jgg Date: 2001-04-29 05:13:51 GMT 'apt-cache policy' preferences debug tool.
* Join with aliencodeArch Librarian2004-09-201-0/+197
Author: jgg Date: 2001-02-20 07:03:16 GMT Join with aliencode