xbps: merge another patch from git master to really fix xbps-create.

This commit is contained in:
Juan RP 2013-05-27 14:00:24 +02:00
parent dd4d8c94bc
commit c9b9f32e96
2 changed files with 45 additions and 1 deletions

View file

@ -0,0 +1,44 @@
From fa9d3471d921e1d49cdddeeab546d61f04bc1cf1 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Mon, 27 May 2013 13:03:40 +0200
Subject: [PATCH] xbps-create: improve d6605e1b97 (sanitize destdir to resolve
target files in symlinks).
Previously in d6605e1b97 if destdir had trailing '/' the behavior
of detecting target files in symlinks was changed slightly.
---
bin/xbps-create/main.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index 2a2373d..5d0a265 100644
--- bin/xbps-create/main.c
+++ bin/xbps-create/main.c
@@ -178,7 +178,7 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf)
{
struct xentry *xe = NULL;
const char *filep = NULL;
- char *buf, *p, *dname;
+ char *buf, *p, *p2, *dname;
ssize_t r;
(void)ftwbuf;
@@ -237,7 +237,14 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf)
*/
xe->target = strdup(buf);
} else {
- xe->target = strdup(p + strlen(destdir) - 1);
+ /*
+ * Sanitize destdir just in case.
+ */
+ if ((p2 = realpath(destdir, NULL)) == NULL)
+ die("failed to sanitize destdir %s: %s", destdir, strerror(errno));
+
+ xe->target = strdup(p+strlen(p2));
+ free(p2);
free(p);
}
} else if (strchr(buf, '/') == NULL) {
--
1.8.3

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.24
revision=3
revision=4
build_style=configure
configure_args="--prefix=/ --exec-prefix=/usr --sbindir=/usr/sbin
--enable-static --enable-debug --enable-tests"