void-packages/srcpkgs/xbps/patches/0001-xbps-create-if-a-symli...

46 lines
1.4 KiB
Diff
Raw Normal View History

From 42c21e1c3c0fbc98b56bedbc63022c5e086feb40 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 4 Oct 2012 09:40:52 +0200
Subject: [PATCH 1/4] xbps-create: if a symlink points to an unexistent file
store symlink target as is.
Seen in recent builds when building the systemd binpkg:
[chroot] => Building systemd-194_1.x86_64.xbps...
xbps-create.real: main.c:219: ftw_cb: Assertion `p' failed.
Which was asserting in a symlink that was pointing to a file provided by the udev
pkg, therefore realpath(3) failed.
---
bin/xbps-create/main.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index 2a098ca..beb79df 100644
--- a/bin/xbps-create/main.c
+++ b/bin/xbps-create/main.c
@@ -216,9 +216,17 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf)
*/
if (strncmp(buf, "../", 3) == 0) {
p = realpath(fpath, NULL);
- assert(p);
- xe->target = strdup(p + strlen(destdir));
- free(p);
+ if (p == NULL) {
+ /*
+ * This symlink points to an unexistent file,
+ * which might be provided in another package.
+ * So let's use the same target.
+ */
+ xe->target = strdup(buf);
+ } else {
+ xe->target = strdup(p + strlen(destdir));
+ free(p);
+ }
} else if (strchr(buf, '/') == NULL) {
p = strdup(filep);
assert(p);
--
1.7.12.2