[pacman-dev] libarchive warning output
Xavier
shiningxc at gmail.com
Thu Jun 28 13:30:18 EDT 2007
There is one more change with libarchive 2.2.3 vs 1.3.1
When installing a package as user, archive_read_extract now returns
ARCHIVE_WARN instead of ARCHIVE_OK , because it cant set uid to 0, and
also, it can't set suid for the files that have it.
Currently, pacman considers it as errors, instead of warnings. I don't
think it should, but I'm not sure how to handle the warning output
either.
Also, strerror(errno) displayed either "File exists" or "No such file
or directory", I've no idea why... And archive_error_string(archive)
still displays that part, but also adds more helpful message like :
"Can't set UID=0: File exists"
"Can't set UID=0: No such file or directoryCan't make file SUID"
Since with old libarchive, these warnings weren't returned, and so not
displayed, I adpated pacman to keep the same behavior for now. But if
these warnings are useful, they can easily be displayed.
>From 2657a2bfb7847c8ac4dd5875979400d0d3fd89f6 Mon Sep 17 00:00:00 2001
From: Chantry Xavier <shiningxc at gmail.com>
Date: Thu, 28 Jun 2007 19:28:34 +0200
Subject: [PATCH] libalpm/add.c : ignore libarchive warning.
With libarchive 2.2.3 (previously 1.3.1), archive_read_extract now
returns ARCHIVE_WARN
when a package is extracted as user, because for example, UID=0 or
SUID bit can't be set.
This patch makes pacman not treating these warnings as errors anymore,
but simply ignoring them.
Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
---
lib/libalpm/add.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index b6a54b7..1ebf455 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -544,11 +544,12 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
archive_entry_set_pathname(entry, tempfile);
- if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) {
+ int ret = archive_read_extract(archive, entry, archive_flags);
+ if(ret != ARCHIVE_OK && ret != ARCHIVE_WARN) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
- entryname, strerror(errno));
+ entryname, archive_error_string(archive));
alpm_logaction(_("could not extract %s (%s)"),
- entryname, strerror(errno));
+ entryname, archive_error_string(archive));
errors++;
unlink(tempfile);
FREE(hash_orig);
@@ -699,10 +700,14 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
archive_entry_set_pathname(entry, filename);
- if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
filename, strerror(errno));
- alpm_logaction(_("error: could not extract %s (%s)"), filename,
strerror(errno));
+ int ret = archive_read_extract(archive, entry, archive_flags);
+ if(ret != ARCHIVE_OK && ret != ARCHIVE_WARN) {
+ _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
+ entryname, archive_error_string(archive));
+ alpm_logaction(_("could not extract %s (%s)"),
+ entryname, archive_error_string(archive));
errors++;
+ continue;
}
/* calculate an hash if this is in newpkg's backup */
--
1.5.2.2
More information about the pacman-dev
mailing list