mirror of
https://github.com/moparisthebest/pacman
synced 2025-02-28 17:31:52 -05:00
It turns out we do care about directories...
This is a bug that has been around since at least 2007. On a package upgrade (either by -S or -U) a new directory could overwrite any file. This is caused by the filelist difference calculation ignoring all directories and thus no new directories were checked for conflicting files on the filesystem. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
4a427dbc1b
commit
0c2edbdd49
@ -228,34 +228,24 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
|
||||
alpm_file_t *fileA = filesA->files + ctrA;
|
||||
const char *strA = filesA->resolved_path[ctrA];
|
||||
const char *strB = filesB->resolved_path[ctrB];
|
||||
/* skip directories, we don't care about them */
|
||||
if(strA[strlen(strA)-1] == '/') {
|
||||
|
||||
int cmp = strcmp(strA, strB);
|
||||
if(cmp < 0) {
|
||||
/* item only in filesA, qualifies as a difference */
|
||||
ret = alpm_list_add(ret, fileA);
|
||||
ctrA++;
|
||||
} else if(strB[strlen(strB)-1] == '/') {
|
||||
} else if(cmp > 0) {
|
||||
ctrB++;
|
||||
} else {
|
||||
int cmp = strcmp(strA, strB);
|
||||
if(cmp < 0) {
|
||||
/* item only in filesA, qualifies as a difference */
|
||||
ret = alpm_list_add(ret, fileA);
|
||||
ctrA++;
|
||||
} else if(cmp > 0) {
|
||||
ctrB++;
|
||||
} else {
|
||||
ctrA++;
|
||||
ctrB++;
|
||||
}
|
||||
ctrA++;
|
||||
ctrB++;
|
||||
}
|
||||
}
|
||||
|
||||
/* ensure we have completely emptied pA */
|
||||
while(ctrA < filesA->count) {
|
||||
alpm_file_t *fileA = filesA->files + ctrA;
|
||||
const char *strA = fileA->name;
|
||||
/* skip directories */
|
||||
if(strA[strlen(strA)-1] != '/') {
|
||||
ret = alpm_list_add(ret, fileA);
|
||||
}
|
||||
ret = alpm_list_add(ret, fileA);
|
||||
ctrA++;
|
||||
}
|
||||
|
||||
|
@ -16,5 +16,3 @@ self.args = "-S pkg2"
|
||||
self.addrule("PACMAN_RETCODE=1")
|
||||
self.addrule("PKG_VERSION=pkg2|1.0-1")
|
||||
self.addrule("!DIR_EXIST=usr/bin/foo/")
|
||||
|
||||
self.expectfailure = True
|
||||
|
@ -14,5 +14,3 @@ self.args = "-S pkg1"
|
||||
self.addrule("PACMAN_RETCODE=1")
|
||||
self.addrule("PKG_VERSION=pkg1|1.0-1")
|
||||
self.addrule("!DIR_EXIST=file/")
|
||||
|
||||
self.expectfailure = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user