diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-05-10 22:44:33 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-06-03 05:33:47 +0200 |
commit | 0b3d04719db189ad7dbc8b36b5f34d95a5c63646 (patch) | |
tree | 757211785e120fe348a34d1de40194e8bb4181b7 | |
parent | aa7e42db11ea545572a9519e88e2a6cdeeffb3bf (diff) | |
download | pacman-0b3d04719db189ad7dbc8b36b5f34d95a5c63646.tar.gz pacman-0b3d04719db189ad7dbc8b36b5f34d95a5c63646.tar.xz |
conflict.c: exclude trailing slash from file path
After the initial checks, we either use the path as a directory and have
to append the trailing slash anyway or use it as a file in which case
the trailing slash should be excluded.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | lib/libalpm/conflict.c | 12 | ||||
-rw-r--r-- | test/pacman/tests/sync701.py | 2 | ||||
-rw-r--r-- | test/pacman/tests/sync702.py | 2 |
3 files changed, 6 insertions, 10 deletions
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 3121cc79..d44a4594 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -548,12 +548,12 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name); /* localp2->files will be removed (target conflicts are handled by CHECK 1) */ - if(localp2 && alpm_filelist_contains(alpm_pkg_get_files(localp2), filestr)) { + if(localp2 && alpm_filelist_contains(alpm_pkg_get_files(localp2), relative_path)) { /* skip removal of file, but not add. this will prevent a second * package from removing the file when it was already installed * by its new owner (whether the file is in backup array or not */ handle->trans->skip_remove = - alpm_list_add(handle->trans->skip_remove, strdup(filestr)); + alpm_list_add(handle->trans->skip_remove, strdup(relative_path)); _alpm_log(handle, ALPM_LOG_DEBUG, "file changed packages, adding to remove skiplist\n"); resolved_conflict = 1; @@ -562,8 +562,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, /* check if all files of the dir belong to the installed pkg */ if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) { - char *dir = malloc(strlen(filestr) + 2); - sprintf(dir, "%s/", filestr); + char *dir = malloc(strlen(relative_path) + 2); + sprintf(dir, "%s/", relative_path); if(alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) { _alpm_log(handle, ALPM_LOG_DEBUG, "checking if all files in %s belong to %s\n", @@ -590,11 +590,11 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, } /* is the file unowned and in the backup list of the new package? */ - if(!resolved_conflict && _alpm_needbackup(filestr, p1)) { + if(!resolved_conflict && _alpm_needbackup(relative_path, p1)) { alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local); int found = 0; for(k = local_pkgs; k && !found; k = k->next) { - if(alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) { + if(alpm_filelist_contains(alpm_pkg_get_files(k->data), relative_path)) { found = 1; } } diff --git a/test/pacman/tests/sync701.py b/test/pacman/tests/sync701.py index 912c794c..590845ff 100644 --- a/test/pacman/tests/sync701.py +++ b/test/pacman/tests/sync701.py @@ -19,5 +19,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=pkg1|1.0-2") self.addrule("PKG_EXIST=pkg2") self.addrule("FILE_TYPE=lib|dir") - -self.expectfailure = True diff --git a/test/pacman/tests/sync702.py b/test/pacman/tests/sync702.py index 8f4c0ad7..c3e2320a 100644 --- a/test/pacman/tests/sync702.py +++ b/test/pacman/tests/sync702.py @@ -19,5 +19,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=pkg2|1.0-2") self.addrule("PKG_EXIST=pkg1") self.addrule("FILE_TYPE=lib|dir") - -self.expectfailure = True |