summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2019-11-26dpkg: Use DPKG_ADMINDIR to set the admindirGuillem Jover1-1/+1
This was done in the name of security, but it does not make much sense as root should make sure to be running in a clean environment. This is problematic as it makes the interface hard to understand, and produces unexpected behavior as dpkg can be called from within itself, or as a wrapper for dpkg-query, which will then not inherit the admindir value. Closes: #900071
2019-11-26dpkg: Fix and clarify behavior for packages marked to be on “hold”Guillem Jover3-4/+7
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-11-26dpkg-query: Try to use the description from the available file if not installedGuillem Jover1-2/+2
When we have been requested to load the available file, and that contains a description for a package that is not installed, we should use that instead of printing the confusing string stating that the description is not available. Closes: #43573
2019-10-30dpkg, u-a: Make variables staticGuillem Jover1-3/+12
Warned-by: sparse
2019-10-30dpkg: Remove redudant condition for sourcefile in updateavailable()Guillem Jover1-1/+1
The preceding “if” already checks exclusively whether this variable is NULL, so in this branch it will always be non-NULL. Warned-by: cppcheck Fixes: knownConditionTrueFalse
2019-10-30libdpkg, dpkg: Use new versiondescribe_c() for non-localizable call sitesGuillem Jover3-7/+7
The output on log files must not be localized. Reported-by: Julien Cristau <jcristau@debian.org>
2019-10-30libdpkg: Add new C locale switch over supportGuillem Jover5-0/+5
This will make it possible to select either the current locale or a specified one, currently only C is selectable. We use this because the uselocale(3) POSIX API is recent, and the system might not have it available, so we might need to fallback to use setlocale(3) instead, which even though is not thread-safe, it's better than nothing.
2019-10-30dpkg: Initialize flagdeppossi in check_conflict()Guillem Jover1-1/+1
We only use this variable as a sentinel pointer so that we can make sure the pdep pointer is not NULL in subsequent checks. But cppcheck gets confused, so let's initialize it to make the code more future-proof. Warned-by: cppcheck
2019-10-12dpkg: Do not clear selections for unknown packagesGuillem Jover1-1/+1
We should not clear the selections for packages that are not already installed in the system, as they will end up disappearing on the next operation anyway. Closes: #927752
2019-06-03dpkg: Introduce a new dependency try level for trigger cycle checksGuillem Jover2-7/+14
This new dependtry level will also check trigger cycles on trigger process deferral due to unsatisfiable dependencies. Closes: #928429
2019-05-09dpkg: Set the force defaults before loading the config fileGuillem Jover1-1/+1
Otherwise we incorrectly override them. Fixes: commit 52427d9075b4b062fa0db16a70d2c2bda6407857 Closes: #928671
2019-04-08dpkg: Fix off-by-one bug in --abort-after checkTom Goulet1-1/+2
The code checking whether the amount of errors had been reached, was incrementing the counter after the check, which meant it was allowing one more error than expected. [guillem@debian.org: Move return to the next line. ] Closes: #924886 Signed-off-by: Guillem Jover <guillem@debian.org>
2019-02-23libdpkg, dpkg: Print the dpkg database directory on access errorsGuillem Jover1-3/+7
There were several error messages involving the dpkg database, that were ambiguous by referring to it as "dpkg status area", instead of printing the affected pathname. The historical reason for not being more explicit has been to keep the user a bit under the dark, because this has been an internal database storage, and only those in the known would go there to edit it by hand and similar. This is a bit pointless though, because the Internet is full of references to those directories, and other error messages just print them anyway. In addition, for users that want to diagnose what is the problem this is not helpful, and the directory might have been changed at build or run time with one of the options. Closes: #883700
2019-02-23dpkg: Add new option --refuse-security-mac to control SELinuxGuillem Jover4-2/+9
This new option works in both dpkg and dpkg-statoverride. And dpkg will pass it to its children, which means dpkg-statoverride called from a maintainer script will automatically pick it up. Ref: #811037
2019-02-23dpkg-statoverride: Switch from --force option to new --force-<thing> optionsGuillem Jover3-6/+28
Deprecate --force option which will be considered an alias for --force-all for now.
2019-02-23dpkg-statoverride: Add support for --force-* optionsGuillem Jover2-0/+10
2019-02-23dpkg: Parse and set new DPKG_FORCE environment variable for subprocessesGuillem Jover2-0/+12
This will make it possible for third-party tools, and also for other dpkg tools to have access to the force options specified for dpkg. Closes: #666147
2019-02-23dpkg: Switch to set the default force option from the forceinfos arrayGuillem Jover3-2/+17
2019-02-23dpkg: Switch from a char to an enum to track the force options typesGuillem Jover1-32/+37
2019-02-23dpkg: Switch force options from individual variables to bit fieldsGuillem Jover11-137/+165
This makes it easier to generalize to be used by other modules with different force options, and to operate on the force options.
2019-02-23dpkg: Print the current set of enabled force options on --force-helpGuillem Jover2-0/+27
This will make it possible to reason more easily about what is getting enabled.
2019-02-23dpkg: Do not hardcode the program name in the --force-help outputGuillem Jover1-1/+1
We will be using the same logic for other commands.
2019-02-23dpkg: Move force options support into its own fileGuillem Jover6-192/+379
This unifies all force related code in a single file, and will make it possible to use it in other programs.
2019-02-23dpkg: Simplify maintscript_set_exec_context()Guillem Jover1-4/+3
We do not really need to normalize the return code, which was confusing the cppcheck for which we required a supression.
2019-02-23dpkg: Move SELinux fallback label to the SELinux specific code pathGuillem Jover1-3/+3
The wrapper function should be generic, so leaking this SELinux specific detail there is just wrong.
2019-01-22libdpkg: Add proper tar error handlingGuillem Jover3-14/+20
This makes the tar extractor track and report back parse errors, so that we can give more descriptive messages.
2019-01-22libdpkg: Rename pkg_db symbols to pkg_hashGuillem Jover11-65/+65
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-22libdpkg: Cleanup fsys module symbol namesGuillem Jover14-259/+271
2019-01-22libdpkg, dpkg: Rename r variables to fnnGuillem Jover1-10/+7
2019-01-22When allocating use the variable instead of the type in sizeof()Guillem Jover7-10/+10
This makes it easier to guarantee we use the correct size for the involved variable.
2019-01-22dpkg-query: Rename variable to avoid shadowing a local functionGuillem Jover1-4/+4
Warned-by: cppcheck
2019-01-22dpkg: Fix --help output to clarify optional argumentsGuillem Jover1-15/+15
2019-01-22dpkg: Fix typo in commentGuillem Jover1-1/+1
2019-01-22dpkg: Introduce a new dependency try level for trigger processingGuillem Jover3-23/+36
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: Convert one trigger processing required type into the new try-queuedGuillem Jover1-1/+1
This makes the code stop skipping unsatisfiable dependency checks.
2019-01-22dpkg: Split trigger processing types into required, try-queued and try-deferredGuillem Jover2-4/+6
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-22dpkg: Reset progress_bytrigproc once we have injected into the current iterationGuillem Jover1-0/+1
We should not leave the package that could be used to make progress by way of trigger processing in this variable, because it might not have its dependencies satisfied, which means we'll be trying to process it on every next loop, and get into artificialy detected trigger cycles.
2019-01-22dpkg: Move dependtry description from deferred_configure() to its declarationGuillem Jover2-24/+27
This moves the description closer to the type defining its values, which makes more sense than in the configure function.
2019-01-21dpkg: Switch dependtry from an int to an enumGuillem Jover5-11/+33
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-10-08dpkg, dpkg-query: Add new --no-pager optionGuillem Jover2-0/+18
This makes it possible to disable any pager usage from these programs. For dpkg this also becomes a configuration option. Closes: #909754
2018-10-08libdpkg: Pass the file contents to the pager instead of the filenameGuillem Jover2-2/+2
Let's just handle opening the file and passing its data to the pager ourselves, as that gives us more control, and then can decide not to run a pager at all, and do not need to mess with arguments which might need to be passed to «sh -c».
2018-10-08dpkg-divert, dpkg-statoverride: Add new --instdir and --root optionsGuillem Jover3-13/+58
This makes it possible to use alternative installation directories. And will make these commands honor those directories when specified for dpkg, and passed down to the maintainer script via the DPKG_ROOT environment variable.
2018-10-08dpkg: Fix --force-not-rootGuillem Jover4-7/+34
Ignore EPERM for chown and chmod based syscalls. And give a more meaningful error message on chroot(). Closes: #614126
2018-08-30dpkg-query: Support dumping all --status and --print-avail recordsGuillem Jover1-42/+44
When not passing any argument these commands will dump the entire database. This way external programs will have a proper public interface to get all package records, even when there are unmerged journal entries. Closes: #616342