Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
config: Also always error for @config keyword
Emmanuel Vadot committed 4 years ago
commit dca434bfa3c76200c3656abf2eb683e9ee2f6a11
parent 421baf8
2 files changed +17 -1
modified libpkg/pkg_ports.c
@@ -356,7 +356,10 @@ meta_file(struct plist *p, char *line, struct file_attr *a, bool is_config)
			char *content;
			file_to_bufferat(p->stagefd, RELATIVE_PATH(path),
			    &content, &sz);
-
			pkg_addconfig_file(p->pkg, path, content);
+
			ret = pkg_addconfig_file(p->pkg, path, content);
+
			if (ret != EPKG_OK) {
+
				return (ret);
+
			}
			free(content);
		}
	}
modified tests/frontend/configmerge.sh
@@ -4,6 +4,7 @@
tests_init \
	config \
	config_duplicate \
+
	config_duplicate_keyword \
	config_fileexist \
	config_filenotexist \
	config_fileexist_notinpkg \
@@ -71,6 +72,18 @@ EOF
		pkg create -M test.ucl
}

+
config_duplicate_keyword_body()
+
{
+
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
+
	echo "@config ${TMPDIR}/a" > plist
+
	echo "@config ${TMPDIR}/a" >> plist
+

+
	echo "entry" > a
+

+
	atf_check -s exit:1 -e match:"pkg: duplicate file listing: .*" \
+
		pkg create -M test.ucl -p plist
+
}
+

config_fileexist_body()
{
	atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"