summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.c
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2009-01-18 20:03:56 +0100
committerDan McGee <dan@archlinux.org>2009-01-18 13:35:17 -0600
commit472e51b975b9cb8fe1f67c03ff72bbc067fa7f01 (patch)
tree289342e7706c4edddc6d076602e90bc25027cab6 /lib/libalpm/util.c
parent1191303f8b9edc01ff969e2433f5c40c9a95474a (diff)
downloadpacman-472e51b975b9cb8fe1f67c03ff72bbc067fa7f01.tar.xz
Use archive_entry_set_perm instead of archive_entry_set_mode
This patch fixes FS#12148 ('unstable' regular file). I also changed the other archive_entry_set_mode usage in add.c to archive_entry_set_perm. Since I cannot find any relevant info in libarchive manual, I quote Tim Kientzle (the author of libarchive) here, and I say thank you for his help. *** Tim Kientzle wrote ************************************* This is the problem in libalpm/util.c: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_mode(entry, 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_mode(entry, 0755); 327 } Your example unstable.db.tar.gz is not empty. It has one entry in it, called "./". That entry is marked as a directory. But, when you call archive_entry_set_mode(), you are changing the file type! archive_read_extract() then creates the file /var/unstable as you requested. (archive_read_extract() will replace an empty directory with a file.) You should either set the mode value correctly: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_mode(entry, IFREG | 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_mode(entry, IFDIR | 0755); 327 } Or use archive_entry_set_perm(), which does not change the file type: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_perm(entry, 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_perm(entry, 0755); 327 } ************************************************************ Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/util.c')
-rw-r--r--lib/libalpm/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index da3463b0..be465afa 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -310,9 +310,9 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
entryname = archive_entry_pathname(entry);
if(S_ISREG(st->st_mode)) {
- archive_entry_set_mode(entry, 0644);
+ archive_entry_set_perm(entry, 0644);
} else if(S_ISDIR(st->st_mode)) {
- archive_entry_set_mode(entry, 0755);
+ archive_entry_set_perm(entry, 0755);
}
/* If a specific file was requested skip entries that don't match. */