summaryrefslogtreecommitdiff
path: root/src/trigproc.c
AgeCommit message (Collapse)AuthorFilesLines
2019-11-26dpkg: Fix and clarify behavior for packages marked to be on “hold”Guillem Jover1-1/+2
A package marked to be on hold, denotes that the package should be kept in its current version and should not be automatically installed, upgraded or removed. The same applies to frontends. This behavior does not apply when the user explicitly requested one of these actions, or the --force-hold option is used. It should never prevent dpkg from processing these for configuration (if they were already in unpacked state) or from trigger processing, otherwise we might get into trigger loops. Some of the code was already doing this, but this was not consistently done. We update also the help output and documentation to clarify the fixed behavior. Closes: #926472
2019-06-03dpkg: Introduce a new dependency try level for trigger cycle checksGuillem Jover1-3/+5
This new dependtry level will also check trigger cycles on trigger process deferral due to unsatisfiable dependencies. Closes: #928429
2019-01-22libdpkg: Rename pkg_db symbols to pkg_hashGuillem Jover1-12/+12
These are handling a package hash, and db seems to imply some kind of on-disk storage. Rename the pkgiterator too to pkg_hash_iter to make it consistent.
2019-01-22dpkg: Introduce a new dependency try level for trigger processingGuillem Jover1-17/+25
The introduction of dependency satisfiability for trigger processing, which was in the original spec but not the implementation, there has been countless problems with bogus detection of trigger cycles. The problem is that whenever we try to process triggers for a package, we might not be able to due to dependency unsatisfiaiblity, which means we have to put the package back into the queue. If we add the state into the cycle detection tracker, then multiple visits to these packages will hit the cycle detection for artificially generated cycles. But we cannot avoid performing the checks because that will miss dynamic cycles coming from maintainer scripts, for example. To avoid most of these problems (while possibly not fixing all potential ones), we should delay trigger processsing entirely until we have emptied the processing queue as much as possible. We do that by introducing a new dependency try level, after the dependency cycle breaking one. We will also make the trigger cycle detection unconditional of the dependency try, because for the trigproc try-queued it will not matter anymore as we will only ented on higher dependency tries, and for the other trigproc types we should not care about any queue-specific dependency try level. Closes: #810724, #854478, #911620
2019-01-22dpkg: Move trigproc cycle reset inside try-deferred conditionalGuillem Jover1-11/+10
We should only reset the cycle detection in case we are not bailing out from the processing with an error, otherwise we could come back to this package and detect an artificial trigger cycle.
2019-01-22dpkg: Split trigger processing types into required, try-queued and try-deferredGuillem Jover1-2/+2
Each of these reasons for processing triggers have different requirements and attributes: - The required one, must perform all checks as it is done as part of a simple loop to guarantee Pre-Depends satisfiability. - The try-deferred one, must not fail on unsatisfiable dependencies, as we are doing opportunistic trigger processing, after a normal processing queue run. - The try-queued one, must perform all checks and fail hard if any unsatisfiable scenario occurs.
2019-01-21dpkg: Switch dependtry from an int to an enumGuillem Jover1-2/+2
Thiw makes the code way easier to understand as there no magic numbers anymore. It will also make it trivial to add new levels in-between.
2019-01-15dpkg: Mark the package we are giving up on a trigger cycle as istobe normalGuillem Jover1-0/+1
Once we are giving up on a package that we will stop processing, we need to mark it as PKG_ISTOBE_NORMAL so that the dependency checks know they cannot expect this package to be processed anymore. Otherwise we might end up never detecting that we are not making progress, as we expect to process this package at a later point, when that will never happen anymore. This then would end up causing asserts in the process queue loop. Closes: #901127, #910819
2019-01-15dpkg: Factor trigproc_new_cyclenode() out from check_trigger_cycle()Guillem Jover1-12/+25
2019-01-15dpkg: Use common pattern of assigning as an iteratorGuillem Jover1-1/+1
Assign hare->next to hare instead of using the temporary variable, so that it's quicker to spot as an iterator assignment.
2019-01-15dpkg: Initialize trigcyclenode's next member onceGuillem Jover1-2/+1
Initialize the next member when we are allocating the struct.
2019-01-15dpkg: Negate tortoise_not_in_hare() function name and return valueGuillem Jover1-5/+5
Makes its usage more obvious.
2018-08-30libdpkg: Move db-fsys code from src to lib/dpkgGuillem Jover1-1/+1
This will prepare the ground for external programs to start using libdpkg to access the dpkg fsys database via a proper API, instead of messing with the on-disk layout in so many improper ways.
2018-08-30dpkg: Call ensure_package_clientdata() defensivelyGuillem Jover1-0/+2
We want to stop calling this function from the fsys loading code, so we should make very sure it is being called before we access the clientdata members, otherwise we'll just segfault.
2018-05-04libdpkg: Move control database code into db-ctrl modulesGuillem Jover1-1/+1
This continues the work to generalize and make these interfaces available to other users beside dpkg itself.
2018-05-03libdpkg: Use a single struct filenamenode definitionGuillem Jover1-7/+1
The struct filenamenode hash implementation is lightweight, and once split from the bulk of the on-disk database handling there's no point in reimplementing it, and then redefining the same struct in multiple places, which is rather confusing for the reader, and even for static analyzers. Closes: #746766
2018-03-26Use internerr() or BUG() instead of assert()Guillem Jover1-5/+10
The problem with assert() is that it does not print the contents of the variables. It also can be disabled on NDEBUG. But we always want these consistency checks no matter what, and they are not performance sensitive anyway. Enable -Wno-nonnull-compare so that we can keep doing run-time non-NULL checks in functions, instead of just compile-time checks.
2017-05-06doc: Spelling fixesJosh Soref1-1/+1
Signed-off-by: Guillem Jover <guillem@debian.org>
2016-02-27libdpkg, dpkg: Rename iterators from ‘it’ to ‘iter’Guillem Jover1-8/+8
2015-10-18Update Ian Jackson's email addressGuillem Jover1-1/+1
2014-12-27dpkg: Reset trigger cycle tracking on unsatisfied dependencies during trigprocGuillem Jover1-0/+7
If we are not going to process triggers due to an unsatisfied dependency, we should reset the trigger cycle tracking information so that we do not end up reporting bogus cycle errors. Closes: #771730
2014-11-22libdpkg: Register all pending triggers for deferred processingGuillem Jover1-0/+38
Trigger processing on the deferred stage is just opportunistic, but we enqueue all currently pending triggers that might have been activated on a previous unpack run, only when being called as «dpkg --configure pkgname…». This is a mostly conformant workaround for frontends like apt that do not correctly call «dpkg --configure -a» or «dpkg --triggers-only -a» after their normal runs, and leave packages in triggers-pending and triggers-awaited states. Closes: #766758
2014-11-22dpkg: Fail on trigger processing when it is required to progressGuillem Jover1-3/+17
Trigger processing is sometimes required and sometimes opportunistic. When trying to make progress on the packages queue, we need to consider it an error if the dependencies cannot be satisfied in this run. But if we are running the deferred trigger processing, then we should not fail, as that's just opportunistic. Closes: #768852
2014-10-25dpkg: Perform trigger cycle detection earlier or later depending on dependtryGuillem Jover1-4/+11
Do trigger cycle detection after dependency checks in dependtry <= 1, and before dependency cycle breaking in dependtry > 1. This makes sure to always catch trigger cycles, but still gives the opportunity to try to process triggers for packages that are not yet ready in the first dependtry, but which might be a bit later on, without wrongly detecting avoidable and bogus trigger cycles. Closes: #766557
2014-10-20dpkg: Rework dependency problem debug and notices on trigproc()Guillem Jover1-11/+7
The dependencies_ok() function already prints adequate debugging information, there's no point repeating it in the call site. Add also a notice() in case we end up forcing the dependency.
2014-10-20dpkg: Fix trigger dependency checks and cycle detectionGuillem Jover1-3/+7
Break dependency cycles on dependtry > 1 in trigproc(), before calling dependencies_ok(). But if we have a dependency cycle where a package A awaits triggers and package P has them pending, and both depend on each other, the dependency cycle breaking code is not smart enough to break it at the correct place, as the relationship is directional. So we handle it specially on deppossi_ok_found(), in case we are in the cycle breaking dependtry. Otherwise we just defer it, but do not record that it can be fixed by trigger processing, because we would get into an inifite loop. Move trigger cycle detection after dependency checks, so that it does not detect bogus trigger cycles that would have been avoided simply by the dependency checks and cycle breaking code. Regression introduced in commit 35c1c59cfad75d75b3d98974ad201f95d932adb6. Closes: #765434, #765668, #765734, #765781, #765789, #765952
2014-10-12dpkg: Defer trigger processing if the packages do not fulfill dependenciesGuillem Jover1-0/+23
The spec specified this behavior, but the code never abided by it. Change it now that most of the packages with trigger cycles have been switched to noawaiting triggers. The rest will make dpkg bail out on upgrade. We might need to add appropriate versioned Breaks before the Debian release to get a smoother distribution upgrade. Closes: #671711
2014-10-06dpkg: Do not print pointers in debug output messagesGuillem Jover1-1/+1
This does not give any meaningful information, besides the pointers being equal or different. Print an actual file or package name instead.
2014-08-09Replace obsolete <sys/fcntl.h> with <fcntl.h>Fredrik Fornwall1-1/+1
The standard location <fcntl.h> instead of <sys/fcntl.h> is the preferred one since a long time (Changelog.old mentions this change being made in 1996). This patch fixes the two occurrences that have slipped through, making the includes consistent with other files in dpkg as well as fixing compiling on e.g. Android which lacks <sys/fcntl.h>. Closes: #752036 Signed-off-by: Guillem Jover <guillem@debian.org>
2014-06-02libdpkg: Uppercase and namespace pkgstatus enum valuesGuillem Jover1-13/+13
2014-05-19libdpkg, dpkg: Use new status to names mapping functionsGuillem Jover1-2/+2
This gets rid of the need to export the statusinfos and wantinfos variables from libdpkg.
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover1-1/+1
2013-12-07dpkg: Rename add_to_queue() to enqueue_package()Guillem Jover1-1/+1
2013-11-23dpkg: Get rid of post_postinst_tasks_core()Guillem Jover1-11/+3
Fold post_postinst_tasks_core() into post_postinst_tasks(), and replace open-coded implementation in trigproc().
2013-11-23dpkg: Rename and unify maintscript function namesGuillem Jover1-2/+2
2013-10-17dpkg: Print the package version on main progress messagesGuillem Jover1-2/+3
This should help people diagnose problems by providing more context on what's going on by being explicit about what packages is being handled.
2013-04-14dpkg: Refactor tortoise_not_in_hare() out from check_trigger_cycle()Guillem Jover1-35/+44
2013-04-14dpkg: Move modstatdb_note() calls from post_postinst_tasks_core() to call sitesGuillem Jover1-1/+2
This moves the calls near where the package status is being changed, and makes it obvious that we are creating an update log entry.
2012-06-30Switch to new notice() output functionGuillem Jover1-3/+2
This switches all ad-hoc stderr printing for error notices to the notice() function.
2012-04-03Move pkg_infodb_get_dir() and pkg_infodb_get_file() to infodb-format.cGuillem Jover1-0/+1
These functions have never belonged in the filesdb module, but were put there temporarily for convenience.
2012-04-03Rename pkgadmin*() to pkg_infodb_get_*()Guillem Jover1-3/+5
2012-04-01Use cmp() == 0 instead of !cmp()Guillem Jover1-1/+1
2012-03-18dpkg: Change debug output to always arch-qualify package namesGuillem Jover1-9/+9
2012-03-14dpkg: Use package specifiers in statusfd and log messagesGuillem Jover1-2/+2
The colon is often used as a separator but it is always preceded and/or followed by a space so that it's possible to distinguish between the colon used as a separator and the colon embedded in a package name (like in "libc6:amd64"). Based-on-patch-by: Raphaël Hertzog <hertzog@debian.org> Patch-sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>
2012-02-18Use new package status setters instead of direct assignmentsGuillem Jover1-8/+17
This does not apply for package constructors.
2012-02-01Change debug, progress and error output to use package specifiersGuillem Jover1-18/+28
Replace pkg->set->name with varbuf_add_pkgbin_name(), pkgbin_name() or pkg_name(). This only changes informative output, so no behaviour change should result from this. Based-on-patch-by: Raphaël Hertzog <hertzog@debian.org> Patch-sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>
2012-02-01dpkg: Pass struct pkgbin to log_action()Guillem Jover1-1/+1
2012-01-23libdpkg: Pass pkgbin to trig_parse_ci callbacksGuillem Jover1-6/+8
[hertzog@debian.org: - Track pkgbin in struct trigfileint. ]
2012-01-09libdpkg: Pass pkginfo instead of void * to trig_parse_ci callbacksGuillem Jover1-5/+5
Use strict types instead of a ‘void *’ pointer.
2011-11-14Replace all pkg_db_iter_next() calls with pkg_db_iter_next_pkg()Raphaël Hertzog1-2/+2
Sponsored-by: Linaro Limited Signed-off-by: Guillem Jover <guillem@debian.org>