Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix bad path in error message
Baptiste Daroussin committed 6 years ago
commit f7e1a3fa5073cbd53a4661d7070d67becdbb130c
parent 94d0f4a
2 files changed +15 -3
modified libpkg/pkg_ports.c
@@ -241,7 +241,7 @@ dir(struct plist *p, char *line, struct file_attr *a)
	if (fstatat(p->stagefd, RELATIVE_PATH(path), &st, AT_SYMLINK_NOFOLLOW)
	    == -1) {
		pkg_errno("Unable to access file %s%s",
-
		    p->stage ? p->stage: "/", RELATIVE_PATH(path));
+
		    p->stage ? p->stage: "", path);
		if (p->stage != NULL)
			ret = EPKG_FATAL;
		if (ctx.developer_mode) {
@@ -308,7 +308,7 @@ meta_file(struct plist *p, char *line, struct file_attr *a, bool is_config)
	if (fstatat(p->stagefd, RELATIVE_PATH(path), &st, AT_SYMLINK_NOFOLLOW)
	    == -1) {
		pkg_errno("Unable to access file %s%s",
-
		    p->stage ? p->stage : "/", RELATIVE_PATH(path));
+
		    p->stage ? p->stage : "", path);
		if (p->stage != NULL)
			ret = EPKG_FATAL;
		if (ctx.developer_mode) {
modified tests/frontend/register.sh
@@ -5,7 +5,8 @@
tests_init \
	register_conflicts \
	register_message \
-
	prefix_is_a_symlink
+
	prefix_is_a_symlink \
+
	file_not_found

register_conflicts_body() {
	mkdir -p teststage/${TMPDIR}
@@ -111,3 +112,14 @@ prefix_is_a_symlink_body()
	test -L ${TMPDIR}/target/${TMPDIR}/plop/bla/1 || atf_fail "symlinks failed 1"
	test -L ${TMPDIR}/target/${TMPDIR}/plop/bla/2 || atf_fail "symlinks failed 2"
}
+

+
file_not_found_body()
+
{
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1" "/prefix"
+
	echo "foo" > plist
+
	mkdir -p ${TMPDIR}/target
+
	atf_check \
+
		-e match:"Unable to access file ${TMPDIR}/prefix/foo" \
+
		-s exit:74 \
+
		pkg -r ${TMPDIR}/target register -M ${TMPDIR}/test.ucl -f ${TMPDIR}/plist -i ${TMPDIR}
+
}