summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2011-10-27Switch from pkginfo->name to pkginfo->set->nameGuillem Jover16-200/+228
Remove now unused struct pkginfo name member.
2011-10-27Update deppossi->ed to point to a pkgset instead of a pkginfoGuillem Jover7-45/+50
It represents only the package name of the dependency. Later deppossi will grow an architecture parameter that will allow us to transform that pkgset into the correct pkginfo (depending on the context). Note that this transformation depends on the dependency type (possi->up->dep_type) and as such it won't be done at parsing time but rather every time that we need to analyze a specific dependency. [hertzog@debian.org: (Sponsored-by: Linaro Limited) - Update code for new location of depended struct. - Update call sites for pkg_db_find() returning pkginfo. ] Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-27Move the reverse dependencies from struct pkgbin to struct pkgsetRaphaël Hertzog6-19/+16
Reverse dependencies only consider the package name and not the package architecture, so they should logically be part of pkgset and not pkgbin. To reflect this, the next commit will fix struct depossi so that its ed member points to a pkgset. Sponsored-by: Linaro Limited [guillem@debian.org: - Move reverse dependencies into a new anonymous depended struct, instead of two members; available_revdeps and installed_revdeps. ] Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-24dpkg: Add --foreign-architecture and --print-foreign-architectures optionsRaphaël Hertzog3-0/+49
Two new options to dpkg, needed for multiarch: * --foreign-architecture lets you specify that packages for the named architecture should be installable without the use of --force-architecture. * --print-foreign-architectures prints out a space-separated list of all architectures so configured, so that front-ends can query the list. Sponsored-by: Linaro Limited [guillem@debian.org: - Move dpkg option to the correct section in the man page. - Add --help output for both options. - Handle arch_foreign and arch_unknown separately in set_foreign_arch(). - Be consistent with naming of arch plural with the rest of the code. - Rename act_foreignarches to act_printforeignarches. ] Based-on-patch-by: Steve Langasek <steve.langasek@canonical.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-24dpkg: Use dpkg_arch_get_native() instead of native_archGuillem Jover4-4/+2
2011-10-24libdpkg: Update pkgbin.arch to be a pointer to struct dpkg_archRaphaël Hertzog2-4/+4
Sponsored-by: Linaro Limited [guillem@debian.org: - Distinguish between missing and empty Architecture field. ] Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-24libdpkg: Add Multi-Arch field supportGuillem Jover1-0/+1
This field will allow to satisfy dependencies between packages of different architectures (beyond Architecture: all), and co-install a package with the same name but different architecture. The permitted values are: * “no” This value is equivalent to the current default, the omission of the field. * “same“ This package is co-installable with itself, but it must not be used to satisfy the dependency of any package of a different architecture from itself. * “foreign” The package is not co-installable with itself, but should be allowed to satisfy the dependencies of a package of a different architecture from itself. * “allowed” This permits the reverse-dependencies of the package to annotate their Depends: field to indicate that a foreign architecture version of the package satisfies the dependencies, but does not change the resolution of any existing dependencies.
2011-10-24dpkg: Refactor disappear code into its own pkg_disappear() functionRaphaël Hertzog1-28/+35
[guillem@debian.org: - Rename disappear_package to pkg_disappear. - Rename infavor argument to infavour. - Update debug output. ] Signed-off-by: Guillem Jover <guillem@debian.org>
2011-10-14Merge commit '1.16.1.1'Raphaël Hertzog1-0/+2
2011-10-13dpkg: Use statfs() to retrieve the infodb filesystem block sizeGuillem Jover1-5/+7
This fixes two related issues when the FIGETBSZ ioctl fails, it avoids a file descriptor leak because we can get the block size before the loop, and avoids a segfault when sorting the package array due to the cliendata possibly being NULL on some of the package entries because we can bail out before performing the actual sorting. We use the Linux specific statfs(2), because it does way less work than statvfs(3) and the surrounding code is already non-portable due to its dependency on FIEMAP. LP: #872734
2011-10-06dpkg: fix trigger setup code to not reset the status of unconfigured packagesRaphaël Hertzog1-0/+2
The change in commit a36cadba41b19d5908bdfcb658cf01af07c1436a was wrongly assuming that all packages would be in one of the states triggers-awaited, triggers-pending or installed when trig_transitional_activate kicks in. That is not the case and the status reset should hence only be done when the current status is already such that the trigger information are meaningful. transitional_interest_callback_ro() is already taking care to not add anything in the Triggers-Pending field when the status is such that it would not make sense. Reported-by: Hector Oron <hector.oron@gmail.com>
2011-09-29Do not assume existence of paths on the build system in the test suiteGuillem Jover1-1/+1
Instead of using /etc use a known to exist directory in the build tree, and instead of hardcoding /bin/true, let the command module find it in the PATH.
2011-09-18dpkg: Destroy the dpkg_error variables on warningsGuillem Jover1-0/+2
The leak on cmpversions() does not pose any issue on normal operation as the program will exit immediately and the memory will be freed by the system, but once --command-fd is enabled, it could actually be a problem due to a long running dpkg process leaking repeatedly. The leak on parse_db_version() is actually problematic as it can act repeatedly if there's tons of warnings when parsing. Regression introduced in commit ccc26399f2f0e295da1206c5ce81fe81a5dc0e21. Reported-by: Niels Thykier <niels@thykier.net>
2011-09-18dpkg: Do not fail on version parsing warnings in --compare-versionsGuillem Jover1-4/+12
The bogus versions might get fed into «dpkg --compare-versions» by way of maintainer scripts, which would get the bogus versions from the database, somewhere dpkg still allows those to exist.
2011-09-18libdpkg: Switch parseversion() to use dpkg_errorGuillem Jover1-7/+5
This allows to merge back the parseversion_lax() and version_strict_check() functions into a single parseversion(), which performs all the validation, but issues different types of dpkg_error messages on error. Which simplifies parse_db_version() and will allow for callers to distinguish the error conditions and handle them as they see fit.
2011-09-18libdpkg: Refactor path basename code into new path_basename functionGuillem Jover1-3/+2
This function is an equivalent of the GNU basename, but this one will work consistently on any system regardless of libc used.
2011-09-09dpkg: Refactor control directory creation on unpackGuillem Jover1-31/+43
2011-09-09Do not include trailing slash for directory string literalsGuillem Jover3-5/+5
This makes it more natural to manage the directory names, and avoids some doubled slashes.
2011-09-09dpkg: Fix double “error:” string in missing PATH error outputGuillem Jover1-1/+1
Closes: #639997
2011-09-09dpkg: Print a message instead of asserting on readlink/stat size discrepancyGuillem Jover2-2/+8
This will help the user diagnose which file was affected and in correcting the situation, which in most cases is due to file system breakage, or non POSIX compliance. Closes: #639229
2011-09-09dpkg: Change type of variable r from int to ssize_t in conffderef()Guillem Jover1-2/+2
2011-09-09libdpkg: Rename fd_null_copy() to fd_skip()Guillem Jover2-4/+4
2011-08-21dpkg: correctly handle a hardlink pointing to a conffileRaphaël Hertzog1-1/+1
Normal files tagged as a conffile are not tagged with fnnf_deferred_rename and due to this the hardlinking code was assuming that the target is in its final location already. This is obviously not the case for a conffile. Fix the code so that the hardlinking logic takes into account the fact that conffiles are unpacked in .dpkg-new and stay there until the configuration phase. Reported-by: Igor Pashev <pashev.igor@gmail.com>
2011-08-20Fix spelling errorsGuillem Jover1-1/+1
Found by codespell.
2011-08-20dpkg: Clarify --update-avail usage error messageGuillem Jover1-1/+2
Unify the reference to the Packages-file to match the one used on the man pages and on the --help output. Closes: #628055
2011-08-13dpkg: Defer hardlink renames to avoid breakage on unpackGuillem Jover1-1/+2
This fixes two issues related to making the new file contents available through an alternative but final path before 1) the one "carrying" the content has been fsync()ed, to avoid getting garbage on system failure. 2) the deferred fsync() on the main path has been performed, avoiding a possible error when reopening the file for writing if it's currently under execution. Deferring the hardlink is safe as they are always after the tar entry containing the actual file data. Regression introduced in commit 9cd41fdda1c27169c52d73b3b3ce71991d724994. Closes: #635683 Reported-by: Niko Tyni <ntyni@debian.org> Based-on-patch-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Guillem Jover <guillem@debian.org>
2011-07-27dpkg-divert: fix the test-suite to also skip tests that would fail if run as ↵Raphaël Hertzog1-3/+3
root
2011-07-20dpkg: fix possible segfault in findbreakcycle().Raphaël Hertzog1-0/+2
The circumstances are not entirely clear because clear_istobes() is called earlier in the code and should already ensure that clientdata is allocated for all packages in the database but the stack trace reported leaves no room for any other interpretation. We must protect the access to tpkg->clientdata in findbreakcycle() with ensure_package_clientdata(tpkg). Probably that some other parts of the code might create new packages in the in-memory database depending on some specific conditions. It might be that those conditions only hold for a multiarch-enabled dpkg for example if the code looks up a package entry for an alternative architecture and would thus create the package on the fly. This is pure speculation because I did not push the investigations that far. It might be something entirely different but it doesn't matter much because the proposed fix is the same and just ensures that we respect our API by protecting the access to clientdata. See https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/733414 for details.
2011-07-07libdpkg: Rename myopt module to optionsGuillem Jover14-14/+14
2011-07-07Fix printforhelp string in dpkg-divert and dpkg-statoverrideGuillem Jover2-2/+2
2011-07-07Use new dpkg_set_progname and dpkg_get_progname instead of thisnameGuillem Jover7-20/+21
The current implementation demanded libdpkg users to define thisname themselves, which is not really a nice interface to offer to programs. Closes: #631757
2011-07-07libdpkg: Do not require programs to define printforhelpGuillem Jover5-11/+14
Instead define it in myopt.c and initialize it through a new argument to myopt().
2011-07-07dpkg: Use braces on ‘if’ to avoid ambiguous ‘else’Guillem Jover1-1/+2
Warning introduced in commit fc625d161382abc41b984ca9ee1e32ad4f295c67.
2011-07-05dpkg: Mark error message for translationSven Joachim1-1/+1
Missed in commit fc625d161382abc41b984ca9ee1e32ad4f295c67.
2011-07-05dpkg: add the missing ohshite() on a failed syscallRaphaël Hertzog1-0/+2
2011-06-30dpkg: Unpack missing shared directories when the package is replacedGuillem Jover1-10/+16
When unpacking a directory missing in the file system with that path shared by at least one other package, from a package that is Replaced by other packages, assume the missing path is a shared directory and avoid setting ‘keepexisting’ and as such returning prematurely from tarobject(), because in that case we need to recreate the lost directory. As a side effect this also prevents printing the message “Replaced by files in installed package” which is bogus in this case, as directories are always shared. Regression introduced in commit 00e5640a99be03aba40c9e08a663b90d8f8aa797. Closes: #631808
2011-06-26Fix bad indentation in various parts of the codeRaphaël Hertzog1-3/+3
2011-06-25dpkg: implement "interest-noawait" and "activate-noawait" trigger commandsRaphaël Hertzog1-4/+6
Those variants do not put triggering packages in triggers-awaited status and thus do not record the package with the corresponding pending triggers in the Triggers-Awaited field. This should be used for triggers which do not provide essential functionality when we can safely consider that the triggering packages are able to satisfy dependencies even if the trigger processing has not yet happened.
2011-06-25dpkg: do not fallback to "new-prerm failed-upgrade" for downgradesRaphaël Hertzog1-2/+8
If "installed-prerm upgrade" fails, dpkg tries to run "new-prerm failed-upgrade" so that newer versions of packages can work-around a bug in the prerm of the installed package. In the case of downgrade this logic doesn't make any sense since the oldest version can't be aware of the bug in the newest version (that did not exist when the prerm of the oldest version was written). Thus we're disabling the fallback in case of a downgrade or a reinstallation of the same version.
2011-06-18dpkg: ensure that post_postinst_tasks() doesn't introduce bad dataRaphaël Hertzog2-2/+6
The pending triggers were removed because the postinst has just been run, unfortunately in some cases it would restore the status to pending-triggers. This is notably the case when a package is removed while being in triggers-pending and when the prerm fails. In fact it was not correct to remove the pending triggers in this function because only "postinst configure" should clear the pending triggers. Thus move the removal of the pending triggers to deferred_configure() in src/configure.c and reset the status to its "normal" value when the target status is one of triggers-awaited, triggers-pending or installed. With this change, it's no longer possible to have a status of triggers-pending without any pending trigger in trigpend_head. Note that despite this change, the pending triggers are lost during a failed removal because dpkg switches the package to halfconfigured before running "prerm remove" and modstatdb_note() drops the pending triggers in that situation.
2011-06-17dpkg: ensure that trig_transitional_activate() doesn't introduce bad dataRaphaël Hertzog1-0/+7
trig_transitional_activate() is emptying Triggers-Pending without ensuring that the status is set back to something which is not triggers-pending. In theory it's ok because the trig_parse_ci() call is supposed to reactivate all the triggers. But if there's no triggers file any more then we're effectively introducing a skew which is going to be fatal the next time we try to write down the status file. The disparition of the triggers file can happen with file system problems, bad user manipulation or even an old dpkg bug that kept triggers alive when in fact the trigger was dropped from the package. Or the triggers file has effectively been removed in the package but the user has restored an old status file with a triggers-pending status that the current package should no longer be able to generate. In other words, properly resetting the status in trig_transitional_activate() makes dpkg more robust.
2011-05-18dpkg: properly remove triggers information during package removalRaphaël Hertzog1-0/+4
Before this change, a package removal would not remove the triggers information from the internal files. When you reinstalled the same package without any trigger, dpkg would improperly believe that the package implemented some triggers. However the triggers were correctly unregistered during a package upgrade that dropped the triggers. With this commit, we also remove triggers interest file that are empty and thus no longer needed.
2011-05-16dpkg: Keep parent directories of directories kept during removalGuillem Jover3-0/+41
When a directory is kept during removal to be later dealt with during purge, due to the directory containing conffiles from the same package, it not being empty, etc, we should keep all its parent to make sure when the subsequent trial is performed they are properly cleaned up. Closes: #454694 Based-on-patch-by: Ondřej Surý <ondrej@debian.org>
2011-05-16dpkg: On purge remove the conffiles from the file list fileGuillem Jover1-0/+6
This makes sure the files list is correct after the conffiles have been removed from disk and the status db has been updated.
2011-05-16dpkg: Do not preserve and check for conffiles on leftover dir removalGuillem Jover1-5/+4
The function removal_bulk_remove_leftover_dirs() was supposed to be called only w/ left over dirs, but removal_bulk_remove_configfiles() does not remove them from the file list when unlinking. Do not check if the directory needs to be preserved if the package has conffiles inside, because it should have none, although it would match given that the file list still contains conffiles. Do not preserve any lingering conffiles in the file list as they are no longer on disk anyway.
2011-05-15dpkg: Change write_filelist_except() to take a mask intead of a boolGuillem Jover3-6/+7
This generalizes the function to exclude any desired file namenode flag and not just fnnf_elide_other_lists. It also gets rid of the bool variable which is generally a bad interface to change function behaviour when it should really be a named flag or a mask.
2011-05-15libdpkg: Use new writedb flags instead of independent bool variablesGuillem Jover1-1/+1
Using bool to pass flags to a function already taking several arguments is generally a bad interface, as it's not clear from the call sites what each of them refer to. Switch to a proper enum with named flags instead.
2011-05-15dpkg: Make fd variable passed to cu_closefd staticGuillem Jover1-1/+1
The push_cleanup() call takes a pointer to the fd variable which resides in the stack. In case of error and stack unwinding due to longjmp, the value of fd might get overwritten by subsequent stack usage. Thus this kind of variables need to be static so that their value cannot change on stack rollback.
2011-05-15libdpkg: Rename cu_closefile to cu_closestreamGuillem Jover2-2/+2
This should make it clear we are referring to a stdio stream, and not the future planned ‘struct file’.
2011-05-15dpkg: On purge correctly remove a symlink pointing to a directoryGuillem Jover1-0/+9
The code was treating symlinks to directories as directories, but then it was trying to rmdir(2) them, which failed. In such case just verify it's a symlink and unlink(2) them instead.