summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-06-30 00:49:17 +0200
committerDan McGee <dan@archlinux.org>2007-07-02 04:31:40 +0200
commit7a42e24400499873c3b9e1e2315edc808d753734 (patch)
tree153542ffdf613858f238798ae483200b5da76982 /lib/libalpm
parentf55f7f100f650ff040f8721cf761a060af1c05fe (diff)
downloadpacman-7a42e24400499873c3b9e1e2315edc808d753734.tar.gz
pacman-7a42e24400499873c3b9e1e2315edc808d753734.tar.xz
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>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index c9bcea5e..a8da745c 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -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)"),