xbps: add 2 additional patches from git master.
This commit is contained in:
parent
3d66b935a0
commit
26a1cb2791
3 changed files with 161 additions and 1 deletions
|
@ -0,0 +1,29 @@
|
||||||
|
From a6c26f6c12c9abb8789e4ed01c188f83221e985b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Juan RP <xtraeme@gmail.com>
|
||||||
|
Date: Fri, 15 Mar 2013 13:14:57 +0100
|
||||||
|
Subject: [PATCH 1/2] xbps-create: also set st_{uid,gid} to 0:0 in archived
|
||||||
|
files.
|
||||||
|
|
||||||
|
---
|
||||||
|
bin/xbps-create/main.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
|
||||||
|
index fad76fd..22e0e34 100644
|
||||||
|
--- bin/xbps-create/main.c
|
||||||
|
+++ bin/xbps-create/main.c
|
||||||
|
@@ -429,6 +429,11 @@ process_entry_file(struct archive *ar,
|
||||||
|
entry = archive_entry_new();
|
||||||
|
assert(entry);
|
||||||
|
archive_entry_set_pathname(entry, xe->file);
|
||||||
|
+ if (st.st_uid == geteuid())
|
||||||
|
+ st.st_uid = 0;
|
||||||
|
+ if (st.st_gid == getegid())
|
||||||
|
+ st.st_gid = 0;
|
||||||
|
+
|
||||||
|
archive_entry_copy_stat(entry, &st);
|
||||||
|
archive_entry_copy_sourcepath(entry, p);
|
||||||
|
if (st.st_uid == geteuid())
|
||||||
|
--
|
||||||
|
1.8.1.3
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
From 57bb7baf5ec91fcae69ed413e400760950ce492e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Juan RP <xtraeme@gmail.com>
|
||||||
|
Date: Fri, 15 Mar 2013 13:18:30 +0100
|
||||||
|
Subject: [PATCH 2/2] unpack: use archive_entry_{filetype,uid,gid,mode} rather
|
||||||
|
than stored struct stat.
|
||||||
|
|
||||||
|
---
|
||||||
|
include/xbps_api.h.in | 2 +-
|
||||||
|
lib/package_unpack.c | 30 ++++++++++++++++--------------
|
||||||
|
2 files changed, 17 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/xbps_api.h.in b/include/xbps_api.h.in
|
||||||
|
index 3fb9ecd..60df23a 100644
|
||||||
|
--- include/xbps_api.h.in
|
||||||
|
+++ include/xbps_api.h.in
|
||||||
|
@@ -48,7 +48,7 @@
|
||||||
|
*/
|
||||||
|
#define XBPS_PKGINDEX_VERSION "1.7"
|
||||||
|
|
||||||
|
-#define XBPS_API_VERSION "20130310"
|
||||||
|
+#define XBPS_API_VERSION "20130315"
|
||||||
|
|
||||||
|
#ifndef XBPS_VERSION
|
||||||
|
#define XBPS_VERSION "UNSET"
|
||||||
|
diff --git a/lib/package_unpack.c b/lib/package_unpack.c
|
||||||
|
index 7fd3b5c..fd19250 100644
|
||||||
|
--- lib/package_unpack.c
|
||||||
|
+++ lib/package_unpack.c
|
||||||
|
@@ -91,7 +91,6 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
prop_object_t obj;
|
||||||
|
prop_data_t data;
|
||||||
|
void *instbuf = NULL, *rembuf = NULL;
|
||||||
|
- const struct stat *entry_statp;
|
||||||
|
struct stat st;
|
||||||
|
struct xbps_unpack_cb_data xucd;
|
||||||
|
struct archive_entry *entry;
|
||||||
|
@@ -99,7 +98,7 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
ssize_t entry_size;
|
||||||
|
const char *file, *entry_pname, *transact, *tgtlnk;
|
||||||
|
char *pkgname, *dname, *buf, *buf2, *p, *p2;
|
||||||
|
- int ar_rv, rv, flags;
|
||||||
|
+ int ar_rv, rv, entry_type, flags;
|
||||||
|
bool preserve, update, conf_file, file_exists, skip_obsoletes;
|
||||||
|
bool softreplace, skip_extract, force;
|
||||||
|
uid_t euid;
|
||||||
|
@@ -152,6 +151,7 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
/*
|
||||||
|
* Process the archive files.
|
||||||
|
*/
|
||||||
|
+ flags = set_extract_flags(euid);
|
||||||
|
for (;;) {
|
||||||
|
ar_rv = archive_read_next_header(ar, &entry);
|
||||||
|
if (ar_rv == ARCHIVE_EOF || ar_rv == ARCHIVE_FATAL)
|
||||||
|
@@ -159,14 +159,13 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
else if (ar_rv == ARCHIVE_RETRY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- entry_statp = archive_entry_stat(entry);
|
||||||
|
entry_pname = archive_entry_pathname(entry);
|
||||||
|
entry_size = archive_entry_size(entry);
|
||||||
|
- flags = set_extract_flags(euid);
|
||||||
|
+ entry_type = archive_entry_filetype(entry);
|
||||||
|
/*
|
||||||
|
* Ignore directories from archive.
|
||||||
|
*/
|
||||||
|
- if (S_ISDIR(entry_statp->st_mode)) {
|
||||||
|
+ if (entry_type == AE_IFDIR) {
|
||||||
|
archive_read_data_skip(ar);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -291,7 +290,7 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
if (lstat(entry_pname, &st) == 0)
|
||||||
|
file_exists = true;
|
||||||
|
|
||||||
|
- if (!force && S_ISREG(entry_statp->st_mode)) {
|
||||||
|
+ if (!force && (entry_type == AE_IFREG)) {
|
||||||
|
buf = strchr(entry_pname, '.') + 1;
|
||||||
|
assert(buf != NULL);
|
||||||
|
if (file_exists) {
|
||||||
|
@@ -343,7 +342,7 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- } else if (!force && S_ISLNK(entry_statp->st_mode)) {
|
||||||
|
+ } else if (!force && (entry_type == AE_IFLNK)) {
|
||||||
|
/*
|
||||||
|
* Check if current link from binpkg hasn't been
|
||||||
|
* modified, otherwise extract new link.
|
||||||
|
@@ -386,9 +385,9 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
* in binpkg and apply perms if true.
|
||||||
|
*/
|
||||||
|
if (!force && file_exists && skip_extract &&
|
||||||
|
- (entry_statp->st_mode != st.st_mode)) {
|
||||||
|
+ (archive_entry_mode(entry) != st.st_mode)) {
|
||||||
|
if (chmod(entry_pname,
|
||||||
|
- entry_statp->st_mode) != 0) {
|
||||||
|
+ archive_entry_mode(entry)) != 0) {
|
||||||
|
xbps_dbg_printf(xhp,
|
||||||
|
"%s: failed "
|
||||||
|
"to set perms %s to %s: %s\n",
|
||||||
|
@@ -407,19 +406,22 @@ unpack_archive(struct xbps_handle *xhp,
|
||||||
|
* and change permissions if true.
|
||||||
|
*/
|
||||||
|
if ((!force && file_exists && skip_extract && (euid == 0)) &&
|
||||||
|
- (((entry_statp->st_uid != st.st_uid)) ||
|
||||||
|
- ((entry_statp->st_gid != st.st_gid)))) {
|
||||||
|
+ (((archive_entry_uid(entry) != st.st_uid)) ||
|
||||||
|
+ ((archive_entry_gid(entry) != st.st_gid)))) {
|
||||||
|
if (chown(entry_pname,
|
||||||
|
- entry_statp->st_uid, entry_statp->st_gid) != 0) {
|
||||||
|
+ archive_entry_uid(entry),
|
||||||
|
+ archive_entry_gid(entry)) != 0) {
|
||||||
|
xbps_dbg_printf(xhp,
|
||||||
|
"%s: failed "
|
||||||
|
"to set uid/gid to %u:%u (%s)\n",
|
||||||
|
- pkgver, entry_statp->st_uid, entry_statp->st_gid,
|
||||||
|
+ pkgver, archive_entry_uid(entry),
|
||||||
|
+ archive_entry_gid(entry),
|
||||||
|
strerror(errno));
|
||||||
|
} else {
|
||||||
|
xbps_dbg_printf(xhp, "%s: entry %s changed "
|
||||||
|
"uid/gid to %u:%u.\n", pkgver, entry_pname,
|
||||||
|
- entry_statp->st_uid, entry_statp->st_gid);
|
||||||
|
+ archive_entry_uid(entry),
|
||||||
|
+ archive_entry_gid(entry));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.1.3
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'xbps'
|
# Template file for 'xbps'
|
||||||
pkgname=xbps
|
pkgname=xbps
|
||||||
version=0.21
|
version=0.21
|
||||||
revision=4
|
revision=5
|
||||||
build_style=configure
|
build_style=configure
|
||||||
configure_args="--prefix=/ --exec-prefix=/usr --sbindir=/usr/sbin
|
configure_args="--prefix=/ --exec-prefix=/usr --sbindir=/usr/sbin
|
||||||
--enable-static --enable-debug --enable-tests"
|
--enable-static --enable-debug --enable-tests"
|
||||||
|
|
Loading…
Reference in a new issue