summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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
2018-08-30dpkg-query: Split enqperpackage() into each different actionGuillem Jover1-66/+115
2018-08-30dpkg-query: Flush output for --status, --print-avail and --listfiles at the endGuillem Jover1-2/+1
Do not flush the output on each entry output, instead wait until we have finished to flush it all out. This should speed up the output.
2018-08-30dpkg: Fix use after free in maintainer scripts handlingGuillem Jover1-3/+2
Fixes: commit 44b0bf1a576e3b0cfcb4c87f18d4195c3ffccb8f
2018-08-30dpkg-query: Run --list output through a pager if we are on a terminalGuillem Jover1-79/+31
The current code, checks whether we are running on a terminal, and then truncates the output fields so that it can fit within. This causes data loss and can confuse the user depending where the cut point has happened. Instead we remove that logic, and always redirect the outout through a pager in case we are running on a terminal, which gives full information and does not necessarily emit ugly output. Closes: #898603
2018-08-30libdpkg, dpkg: Use new pager spawning supportGuillem Jover1-7/+12
Use it instead of open-coding it, or piping it via a shell invocation, which required metacharacter escaping.
2018-08-30libdpkg: Split pager specific code into its own moduleGuillem Jover1-1/+2
We also namespace the pager function with the module name.
2018-08-30Switch from strchr() + strlen() to strchrnul()Guillem Jover2-6/+7
2018-08-30libdpkg: Split push_cleanup() into push_cleanup_fallback()Guillem Jover6-23/+23
We separate the function in one that takes one callback, and another that takes two. This simplifies most of the call sites which only need one callback.
2018-08-30libdpkg: Switch to a new tiny struct to track file ondisk identityGuillem Jover1-8/+12
We only need the device and inode numbers for a given file to be able to compare them for identity. Avoid storing the entire struct stat which is rather fat.
2018-08-30libdpkg: Move db-fsys code from src to lib/dpkgGuillem Jover25-1094/+19
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: Move struct perpackagestate handling into its own fileGuillem Jover5-16/+48
This is not really part of the fsys db handling, and we are not making use of it anymore in it, so let's move it somewhere else more appropriate.
2018-08-30libdpkg: Move files list information from dpkg clientdata to pkginfoGuillem Jover7-59/+32
This will make it possible to move the fsys database parsing and dumping code out from dpkg into libdpkg. This is general package information, even if some clients might not be interested in its contents, such as frontends that just manage metadata and drive dpkg itself.
2018-08-30dpkg: Check that clientdata is allocated before using itGuillem Jover3-2/+5
For functions that are supposed to just check the state of a package in a read-only way, make sure the clientdata is allocated, instead of just calling ensure_package_clientdata().