Add conflict for replacing empty directory owned
On 10/07/12 23:28, Dan McGee wrote:
> On Sun, Jul 8, 2012 at 7:13 AM, Allan McRae <allan@archlinux.org> wrote: >> When two packages own an empty directory, pacman finds no conflict when >> one of those packages wants to replace the directory with a file or a >> symlink. When it comes to actually extracting the new file/symlink, >> pacman sees the directory is still there (we do not remove empty >> directories if they are owned by a package) and refuses to extract. >> >> Detect this potential conflict early and bail. Note that it is a >> _potential_ conflict and not a guaranteed one as the other package owning >> the directory could be updated or removed first which would remove >> the conflict. However, pacman currently can not sort package installation >> order to ensure this, so this conflict requires manual upgrade ordering. >> >> Signed-off-by: Allan McRae <allan@archlinux.org> >> --- > <snip> >> >> + /* TODO: this is an overly strict check but currently pacman will not >> + * overwrite a directory with a file (case 10/11 in add.c). Adjusting that >> + * is not simple as even if the directory is being unowned by a conflicting >> + * package, pacman does not sort this to ensure all required directory >> + * "removals" happen before installation of file/symlink */ >> + >> + /* check no other _installed_ package owns the directory */ >> + local_pkgs = _alpm_db_get_pkgcache(handle->db_local); >> + for(local = local_pkgs; local; local = local->next) { >> + alpm_pkg_t *local_pkg = local->data; >> + alpm_filelist_t *filelist; >> + >> + if(pkg == local_pkg) { >> + continue; >> + } >> + >> + filelist = alpm_pkg_get_files(local_pkg); >> + if(_alpm_filelist_contains(filelist, dirpath)) { >> + return 0; >> + } >> + } > > Also a TODO- this can seemingly get rather expensive, as we are adding > another iteration of the local database and all the filelists inside a > loop where we are iterating every file of every to-be-installed > package. So we're at like O(n^123) here. (OK, not that bad, but > something to keep awareness of.) Note that this loop is only called in the very rare case when a directory is in conflict with a file/symlink in a package. And if the conflict is resolved, the time spent loading the filelists for local package is saved during the removal of the empty directory (where we do a very similar loop...). Allan |
| All times are GMT. The time now is 10:16 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.