summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2013-07-18dpkg: Rename processarc.c to unpack.cGuillem Jover3-3/+3
This clarifies the purpose of the file related to the dpkg action to perform.
2013-06-24dpkg: Clarify that --set-selections needs an up-to-date available dbGuillem Jover1-0/+6
Document this in the man page, and warn whenever we find unknown packages during the --set-selections processing. Closes: #703092
2013-05-08perl: Unify regex delimiters to //, {} or <>Guillem Jover1-5/+5
Fixes RegularExpressions::ProhibitUnusualDelimiters. Warned-by: perlcritic
2013-05-08perl: Slurp files more efficientlyGuillem Jover1-3/+4
Do not read each line to then join it, just switch on slurp mode and do it in one go. Use the newly created function file_slurp. Fixes InputOutput::ProhibitJoinedReadline. Warned-by: perlcritic
2013-05-08perl: Use the .. operator instead of C-style for loopsGuillem Jover1-0/+2
Fixes ControlStructures::ProhibitCStyleForLoops. Warned-by: perlcritic
2013-05-04Do not use double-quotes on strings that do not need interpolationGuillem Jover1-62/+62
Using double-quotes imposes a small performance penalty as the perl parser needs to check if any interpolation is needed. Use double-quotes only when the string contains single-quotes. Ideally we'd use double-quotes too for escaped meta-characters that might otherwise be confusing to immediately see if they need interpolation or not, but the policy does not (currently) allow to ignore these. Fixes ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
2013-04-30Do not quote simple identifier hash keys in element accessesGuillem Jover1-10/+10
Addresses ValuesAndExpressions::ProhibitInterpolationOfLiterals. Warned-by: perlcritic
2013-04-29scripts: Do not use sort directly on the return keywordGuillem Jover1-1/+2
Fixes Subroutines::ProhibitReturnSort. Warned-by: perlcritic
2013-04-28Use proper variables instead of barewords for filehandlesGuillem Jover1-12/+12
Fixes InputOutput::ProhibitBarewordFileHandles. Warned-by: perlcritic
2013-04-24Use three-argument form of open in perl codeGuillem Jover1-4/+4
Fixes InputOutput::ProhibitTwoArgOpen. Warned-by: perlcritic
2013-04-24dpkg: On Mac OS X check for update_dyld_shared_cache instead of ldconfigGuillem Jover1-0/+6
2013-04-19Explicitly quote HEREDOC markers in perl codeGuillem Jover1-12/+12
This makes the HEREDOC quoting-style used explicit, so that it's obvious if the code text will get interpolated or not. Fixes ValuesAndExpressions::RequireQuotedHeredocTerminator. Warned-by: perlcritic
2013-04-19test: Add a correct shebang to all test scriptsGuillem Jover1-0/+1
This marks all these files as script files, so that tools like perlcritic do not misrecognize them as modules.
2013-04-19build: Set a default TEST_VERBOSE to 0Guillem Jover1-2/+0
2013-04-19Remove Emacs and vim modelinesGuillem Jover3-7/+0
These just clutter the code base, as adding modelines for each possible editor out there does not scale, and they are currently not exhaustive anyway.
2013-04-14Avoid assignments in C conditionalsGuillem Jover4-10/+22
2013-04-14dpkg: Refactor tortoise_not_in_hare() out from check_trigger_cycle()Guillem Jover1-35/+44
2013-04-14pkg: Change directory to / before executing maintainer scriptsGuillem Jover1-2/+4
This should give maintainer scripts a more stable and sane environment. This change does not work too well with relative admindir paths, as they need to be normalized on input. But then several dpkg tools do not play nice with relative amindirs anyway, and this needs a general cleanup which will be done on subsequent commits. Closes: #686782
2013-04-14dpkg: Activate file triggers on removal more accuratelyGuillem Jover1-3/+4
Activate them only when we know we are inevitably removing things.
2013-04-14dpkg: Defer cleanup of .dpkg-new and .dpkg-tmp paths on removalGuillem Jover1-15/+16
Clean them up only when we are definitely removing the main path.
2013-04-14dpkg: Always reset want status when installing a packageGuillem Jover2-2/+3
Move pkg_set_want() call from wanttoinstall() to the call site in process_archive(), so that the status-want change affects all ‘true’ return values and not just on “selecting previously unselected package”. This also makes wanttoinstall() a function that just performs a decision without acting on it, matching its name. Closes: #162541
2013-04-14dpkg: Always reset want status when removing or purging a packageGuillem Jover1-10/+10
Move pkg_set_want() and modstatdb_note() calls from deferred_remove() to the beginning of the function so that it affects all remove/purge requests, even if it ends up getting ignored so that we can properly update the wanted status. Do not try to set the want status for packages with want_unknown. Closes: #163763
2013-04-14dpkg: Do not call modstatdb_note() unnecessarily on remove or purgeGuillem Jover1-2/+4
Move the modstatdb_note() inside the !f_pending conditional where the want status is being changed, there's no point in always calling this function afterwards if there's been no status change at all.
2013-04-14dpkg: Move modstatdb_note() calls from post_postinst_tasks_core() to call sitesGuillem Jover2-4/+4
This moves the calls near where the package status is being changed, and makes it obvious that we are creating an update log entry.
2013-04-14dpkg: Execute maintainer scripts in a new SELinux execution contextGuillem Jover1-0/+71
Try to create a new execution context based on the current one and the specific maintainer script filename. If it is the same as the current one, use "dpkg_script_t" as a fallback. The maintscript_set_exec_context() function is heavily based on the libselinux rpm_execcon() function, which is licensed as Public Domain.
2013-04-14dpkg: Reload the SELinux label database if it has changedGuillem Jover1-16/+76
Rework the code to use the selabel API instead of the matchpathcon wrappers, so that we can query if the label database has changed during the previous unpack, for example while upgrading the SELinux policy package. This also allows us to more easily free the resources allocated for the label database.
2013-04-14dpkg: Do not check for selabel_lookup_raw() returning "<<none>>" contextGuillem Jover1-5/+3
The selabel_file(5) man page clearly states that the function may never return such context, so do not check for it.
2013-04-14dpkg-query: Always print a descriptive architecture column on --listGuillem Jover1-2/+2
Print a description even for empty or missing architectures, to ensure the column is always filled.
2013-04-04dpkg-statoverride: Refer to path instead of fileGuillem Jover1-5/+5
This clarifies the term removing the need to mention what file actually refers to. And gets rid of a first person usage.
2013-03-18dpkg: Initialize all filenamenode membersGuillem Jover1-0/+1
2013-03-18dpkg: Fix indentationGuillem Jover1-21/+22
The new file was accidentally introduced with old-style indentation.
2013-03-18dpkg: Use colon instead of dot for user:group in debug outputGuillem Jover1-1/+1
2013-03-18dpkg: Remove redundant word in commentGuillem Jover1-1/+1
2013-03-18dpkg: Mark security context error message for translationGuillem Jover1-1/+1
2013-03-18dpkg: Abort installation if we cannot set the security context for a fileGuillem Jover1-3/+3
Not setting the correct security context for a new file might have security implications. If the operation is supported by the system on such path and it fails, abort instead of just printing an error message and continuing as if nothing happened.
2012-10-13dpkg: Take arch into account in virtual packages on remove and configureGuillem Jover1-0/+5
The architecture restrictions were not being considered on package configuration and removal, which would cause a system to end up in broken states. Refuse to get into those states. Closes: #683411
2012-10-13Avoid info database corruption and bogus accesses on unknown format valuesGuillem Jover4-4/+22
Make sure to always read the format file whenever we are about to access the info database, so that we can verify that we understand the format, and bail out otherwise. This fixes a currently possible info database corruption and bogus access, whenever the format is lower than 0 or higher than the last understood one, and makes the info database code future-proof in case new actual formats get introduced.
2012-10-13dpkg: Fix logic on reinstallation of previously configured shared conffilesGuillem Jover1-1/+8
When checking for the validity of the Conffiles database field, do not just assume that a package that is just in stat_unpacked has never before been configured. Instead check if the last configured version is the same as the currently extracted version, which will mean the values in the Conffiles field are valid. Closes: #684776
2012-10-13dpkg: Sync the Conffiles fields for all package instancesGuillem Jover1-1/+48
When configuring the second and subsequent package instances with conffiles, the *.dpkg-new conffiles will have been already handled by the first instance. As such, whenever the *.dpkg-new file is missing, copy the hash from an already processed instance.
2012-10-13dpkg: Properly mark obsolete conffiles on package replacesGuillem Jover4-0/+27
This ensures that when taking over conffiles from another package the obsolete conffiles are marked as such on the other package.
2012-10-13dpkg: Do not consider obsolete conffiles as actively owned by the packageGuillem Jover3-1/+8
This ensures conffile entries are not misshandled nor mixed up when configuring packages owning the non-obsolete conffiles. Otherwise we end up with bogus entries in the database, which could cause unpack failures, leftover directories on removal or wrong processing of conffiles. Closes: #689836 Based-on-patch-by: Andreas Beckmann <debian@abeckmann.de> Signed-off-by: Guillem Jover <guillem@debian.org>
2012-10-13dpkg: Move fileslistvalid check just before write_filelist_except()Guillem Jover1-4/+7
This will allow to insert other actions before the check, and still managing to execute them on each iteration.
2012-10-13dpkg: Remove redundant check for otherpkg being pkg on file replacesGuillem Jover1-1/+1
This check is already covered by comparing if they are part of the same package set. As the fileslistvalid check needs to be moved just before the write_filelist_except() call to be able to insert actions into the loop that get executed on each iteration, this test there would be too late by then, and keeping it standalone does not make much sense, so let's just remove it right away to make the refactoring smoother.
2012-10-05dpkg: Ignore trailing filter subpattern slashes on reinclusion comparisonGuillem Jover1-0/+4
The code was not matching directories on subpatterns due to trailing slashes, which was causing unpack failures as the containing subdirectories were not being unpacked and as such, they were subsequently missing from the file system. While unpacking a «/usr/share/locale/de/LC_MESSAGES/foo.mo» file, for example, something like the following options would trigger this problem: --path-exclude=/usr/share/locale/* --path-include=/usr/share/locale/de/* Closes: #688416
2012-10-05dpkg: Fix filter subpattern debug format stringGuillem Jover1-1/+1
Use a string precision instead of a field width, which was causing the output to be just blanks with the length of the subpattern.
2012-09-27dpkg: Do not print garbage (or worse) on shared conffile debug outputGuillem Jover1-1/+1
The variable was being initialized after the debug statement, and if there was no NUL terminator the code could access out of bounds memory.
2012-09-27dpkg: Fix memory leak in filesavespackage()Guillem Jover1-0/+1
Free the filepackages_iterator also when returning false.
2012-09-27build: Cleanup dpkg-divert unit-test environmentGuillem Jover1-0/+4
Remove variables set by dpkg which affect the dpkg-divert behaviour, and as such make it unreliable and cause test failures. Closes: #687656
2012-09-27dpkg-statoverride: Use “statoverrides” instead of “statusoverrides”Guillem Jover1-1/+1
Closes: #686995
2012-07-01dpkg-query: Fix bogus badusage() strings in control_show()Guillem Jover1-2/+2
Reported-by: Sven Joachim <svenjoac@gmx.de>