xbps{,-static}: merge another patch from master for xbps-create(8).

This commit is contained in:
Juan RP 2015-02-19 09:49:47 +01:00
parent c6410d7a9c
commit a00e1df3fc
3 changed files with 70 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.43.1
revision=7
revision=8
build_style=configure
short_desc="The XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@gmail.com>"

View File

@ -0,0 +1,68 @@
From 69e3a50e75de5a555504a0fc733fd9f484e33a79 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Thu, 19 Feb 2015 09:44:09 +0100
Subject: [PATCH 1/2] xbps-create: handle correctly another case of relative
symlinks.
---
bin/xbps-create/main.c | 2 +-
tests/xbps/xbps-create/basic_test.sh | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index f09a114..e089700 100644
--- bin/xbps-create/main.c
+++ bin/xbps-create/main.c
@@ -283,7 +283,7 @@ ftw_cb(const char *fpath, const struct stat *sb, int type, struct FTW *ftwbuf _u
* Check if symlink is absolute or relative; on the former
* make it absolute for the target object.
*/
- if (strncmp(buf, "../", 3) == 0) {
+ if (strstr(buf, "./")) {
p = realpath(fpath, NULL);
if (p == NULL) {
/*
diff --git a/tests/xbps/xbps-create/basic_test.sh b/tests/xbps/xbps-create/basic_test.sh
index d712403..3460088 100644
--- tests/xbps/xbps-create/basic_test.sh
+++ tests/xbps/xbps-create/basic_test.sh
@@ -58,7 +58,36 @@ symlink_relative_target_body() {
atf_check_equal $rv 0
}
+atf_test_case symlink_relative_target_cwd
+
+symlink_relative_target_cwd_head() {
+ atf_set "descr" "xbps-create(8): relative symlinks to cwd in destdir must be absolute"
+}
+
+symlink_relative_target_cwd_body() {
+ mkdir -p repo pkg_A/usr/include/gsm
+ touch -f pkg_A/usr/include/gsm/gsm.h
+ cd pkg_A/usr/include
+ ln -s ./gsm/gsm.h gsm.h
+ cd ../../../repo
+ xbps-create -A noarch -n foo-1.0_1 -s "foo pkg" ../pkg_A
+ atf_check_equal $? 0
+ cd ..
+ xbps-rindex -d -a repo/*.xbps
+ atf_check_equal $? 0
+ result="$(xbps-query -r root --repository=repo -f foo|tr -d '\n')"
+ expected="/usr/include/gsm/gsm.h/usr/include/gsm.h -> /usr/include/gsm/gsm.h"
+ rv=0
+ if [ "$result" != "$expected" ]; then
+ echo "result: $result"
+ echo "expected: $expected"
+ rv=1
+ fi
+ atf_check_equal $rv 0
+}
+
atf_init_test_cases() {
atf_add_test_case hardlinks_size
atf_add_test_case symlink_relative_target
+ atf_add_test_case symlink_relative_target_cwd
}
--
2.3.0

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.43.1
revision=7
revision=8
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities"