aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-08-03 22:25:05 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-08-30 18:36:15 +0300
commit18e21c8082f37816cedb6b0621264364f5568673 (patch)
tree4d58c6389008fdb36973a894817765612a4e0017 /testdata
parentRedundantLongDescription: lower too short threshold (diff)
downloadpkgcheck-18e21c8082f37816cedb6b0621264364f5568673.tar.gz
pkgcheck-18e21c8082f37816cedb6b0621264364f5568673.tar.bz2
pkgcheck-18e21c8082f37816cedb6b0621264364f5568673.zip
GlobDistdir: check for glob usage with DISTDIR
Resolves: https://github.com/pkgcore/pkgcheck/issues/605 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'testdata')
-rw-r--r--testdata/data/repos/standalone/GlobCheck/GlobDistdir/expected.json3
-rw-r--r--testdata/repos/standalone/GlobCheck/GlobDistdir/GlobDistdir-0.ebuild15
2 files changed, 18 insertions, 0 deletions
diff --git a/testdata/data/repos/standalone/GlobCheck/GlobDistdir/expected.json b/testdata/data/repos/standalone/GlobCheck/GlobDistdir/expected.json
new file mode 100644
index 00000000..56e00b6c
--- /dev/null
+++ b/testdata/data/repos/standalone/GlobCheck/GlobDistdir/expected.json
@@ -0,0 +1,3 @@
+{"__class__": "GlobDistdir", "category": "GlobCheck", "package": "GlobDistdir", "version": "0", "line": "\"${DISTDIR}\"/foo-*.bar", "lineno": 7}
+{"__class__": "GlobDistdir", "category": "GlobCheck", "package": "GlobDistdir", "version": "0", "line": "\"${DISTDIR}\"/\"${DISTDIR}\"/foo-?.bar", "lineno": 8}
+{"__class__": "GlobDistdir", "category": "GlobCheck", "package": "GlobDistdir", "version": "0", "line": "\"${DISTDIR}\"/foo-?-*.bar", "lineno": 9}
diff --git a/testdata/repos/standalone/GlobCheck/GlobDistdir/GlobDistdir-0.ebuild b/testdata/repos/standalone/GlobCheck/GlobDistdir/GlobDistdir-0.ebuild
new file mode 100644
index 00000000..a0480fa7
--- /dev/null
+++ b/testdata/repos/standalone/GlobCheck/GlobDistdir/GlobDistdir-0.ebuild
@@ -0,0 +1,15 @@
+DESCRIPTION="Ebuild with unsafe glob around DISTDIR"
+HOMEPAGE="https://github.com/pkgcore/pkgcheck"
+SLOT="0"
+LICENSE="BSD"
+
+src_install() {
+ doins "${DISTDIR}"/foo-*.bar # bad
+ doins "${DISTDIR}"/"${DISTDIR}"/foo-?.bar # bad
+ doins "${DISTDIR}"/foo-?-*.bar # bad
+
+ doins "${T}"/foo-*.bar # not unsafe dir
+ doins "${DISTDIR}"/foo-1.bar # no glob
+ doins "${DISTDIR}"/"foo-*.bar" # quoted
+ doins "${DISTDIR}"/'foo-*.bar' # quoted
+}