mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
libalpm/add.c : fix for FS #7484
Adds the ARCHIVE_EXTRACT_NO_OVERWRITE libarchive flags for extracting files and directories. This will prevent symlinks for being overwritten by directories. All other files that need to be extracted should already have been deleted previously by pacman. This flag is not used for extracting files in backup array to /tmp/alpm_XXXX, because this file is created by mkstemp first, and so needs to be overwritten by the file from the archive. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
parent
f55f7f100f
commit
7a42e24400
@ -704,7 +704,15 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
|
||||
|
||||
archive_entry_set_pathname(entry, filename);
|
||||
|
||||
int ret = archive_read_extract(archive, entry, archive_flags);
|
||||
/* FS #7484
|
||||
* By default, libarchive 2.2.3 overwrites existing symlinks by directories from the archive,
|
||||
* which isn't the behavior we want.
|
||||
* This can be avoided by using the ARCHIVE_EXTRACT_NO_OVERWRITE flag, and this works
|
||||
* fine because all files where an overwrite could be needed are deleted first :
|
||||
* 1) if it's an upgrade, existing files are removed when the old pkg is removed
|
||||
* 2) if there is a file conflict, but --force is used, then files are also removed : see above
|
||||
*/
|
||||
int ret = archive_read_extract(archive, entry, archive_flags | ARCHIVE_EXTRACT_NO_OVERWRITE);
|
||||
if(ret == ARCHIVE_WARN) {
|
||||
/* operation succeeded but a non-critical error was encountered */
|
||||
_alpm_log(PM_LOG_DEBUG, _("warning extracting %s (%s)"),
|
||||
|
Loading…
Reference in New Issue
Block a user