summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-01-13 11:31:53 +0100
committerMichał Górny <mgorny@gentoo.org>2024-01-13 14:16:49 +0100
commit0bc26d0779f0c933a5c1b5a93cde15a0a9e051bc (patch)
treece372099fecb465fb0fb32735605a56a598cd0e1 /dev-build/samurai
parentMove {dev-util → dev-build}/ninja (diff)
downloadgentoo-0bc26d0779f0c933a5c1b5a93cde15a0a9e051bc.tar.gz
gentoo-0bc26d0779f0c933a5c1b5a93cde15a0a9e051bc.tar.bz2
gentoo-0bc26d0779f0c933a5c1b5a93cde15a0a9e051bc.zip
Move {dev-util → dev-build}/samurai
Signed-off-by: Michał Górny <mgorny@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/34779 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-build/samurai')
-rw-r--r--dev-build/samurai/Manifest1
-rw-r--r--dev-build/samurai/files/samurai-1.2-null_pointer_fix.patch60
-rw-r--r--dev-build/samurai/metadata.xml15
-rw-r--r--dev-build/samurai/samurai-1.2-r2.ebuild32
-rw-r--r--dev-build/samurai/samurai-9999.ebuild28
5 files changed, 136 insertions, 0 deletions
diff --git a/dev-build/samurai/Manifest b/dev-build/samurai/Manifest
new file mode 100644
index 000000000000..9bf19297f143
--- /dev/null
+++ b/dev-build/samurai/Manifest
@@ -0,0 +1 @@
+DIST samurai-1.2.tar.gz 32709 BLAKE2B 86ed79f7d6ab492216cf3bf0e19ff8be8c1ca37e5c99de84b457875fa710d720624bd0de53105ed0b1d382c417aeb7397929cb9a35a8d1b36a11e053bf8d7ff5 SHA512 bbe6a582c34b04f1df53b76c1647aa3e03c4698ebf7591a203935f11ffa05971bbcb86dc1a8c06aeb904cdc741abb08918122810fc47216fed0a6d9f87fd1225
diff --git a/dev-build/samurai/files/samurai-1.2-null_pointer_fix.patch b/dev-build/samurai/files/samurai-1.2-null_pointer_fix.patch
new file mode 100644
index 000000000000..76ffc8cd350f
--- /dev/null
+++ b/dev-build/samurai/files/samurai-1.2-null_pointer_fix.patch
@@ -0,0 +1,60 @@
+CVE-2021-30218 + CVE-2021-30219
+Bug: https://bugs.gentoo.org/786951
+
+Upstream-Commit: https://github.com/michaelforney/samurai/commit/e84b6d99c85043fa1ba54851ee500540ec206918
+From e84b6d99c85043fa1ba54851ee500540ec206918 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Fri, 2 Apr 2021 17:27:48 -0700
+Subject: [PATCH] util: Check for NULL string in writefile
+
+This check was there previously, but was removed in f549b757 with
+the addition of a check during parse that every rule has rspfile
+if and only if it has rspfile_content. However, this fails to
+consider the possibility of those variables coming from the edge
+or global environment. So, re-add the check.
+
+Fixes #67 (https://github.com/michaelforney/samurai/issues/67).
+---
+ util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util.c b/util.c
+index ea5c3ce..2a59881 100644
+--- a/util.c
++++ b/util.c
+@@ -258,7 +258,7 @@ writefile(const char *name, struct string *s)
+ return -1;
+ }
+ ret = 0;
+- if (fwrite(s->s, 1, s->n, f) != s->n || fflush(f) != 0) {
++ if (s && (fwrite(s->s, 1, s->n, f) != s->n || fflush(f) != 0)) {
+ warn("write %s:", name);
+ ret = -1;
+ }
+Upstream-Commit: https://github.com/michaelforney/samurai/commit/d2af3bc375e2a77139c3a28d6128c60cd8d08655
+From d2af3bc375e2a77139c3a28d6128c60cd8d08655 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sun, 4 Apr 2021 03:50:09 -0700
+Subject: [PATCH] parse: Check for non-empty command/rspfile/rspfile_content
+
+This matches ninja behavior and prevents the possibility of a rule
+with an empty (NULL) command string.
+
+Fixes #68 (https://github.com/michaelforney/samurai/issues/68).
+---
+ parse.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/parse.c b/parse.c
+index f79a5ee..b4b98a1 100644
+--- a/parse.c
++++ b/parse.c
+@@ -42,6 +42,8 @@ parserule(struct scanner *s, struct environment *env)
+ var = scanname(s);
+ parselet(s, &val);
+ ruleaddvar(r, var, val);
++ if (!val)
++ continue;
+ if (strcmp(var, "command") == 0)
+ hascommand = true;
+ else if (strcmp(var, "rspfile") == 0)
diff --git a/dev-build/samurai/metadata.xml b/dev-build/samurai/metadata.xml
new file mode 100644
index 000000000000..f797645e008e
--- /dev/null
+++ b/dev-build/samurai/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>orbea@riseup.net</email>
+ <name>orbea</name>
+ </maintainer>
+ <maintainer type="person" proxied="proxy">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">michaelforney/samurai</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-build/samurai/samurai-1.2-r2.ebuild b/dev-build/samurai/samurai-1.2-r2.ebuild
new file mode 100644
index 000000000000..d6584ed27041
--- /dev/null
+++ b/dev-build/samurai/samurai-1.2-r2.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="ninja-compatible build tool written in C"
+HOMEPAGE="https://github.com/michaelforney/samurai"
+if [[ "${PV}" == *9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/michaelforney/samurai.git"
+else
+ SRC_URI="https://github.com/michaelforney/samurai/releases/download/${PV}/${P}.tar.gz"
+ KEYWORDS="amd64 arm arm64 hppa ppc ppc64 ~riscv sparc x86"
+fi
+
+LICENSE="ISC Apache-2.0 MIT"
+SLOT="0"
+
+PATCHES=(
+ "${FILESDIR}/${P}-null_pointer_fix.patch" # 786951
+)
+
+src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install
+ dodoc README.md
+}
diff --git a/dev-build/samurai/samurai-9999.ebuild b/dev-build/samurai/samurai-9999.ebuild
new file mode 100644
index 000000000000..ddd44b78fab1
--- /dev/null
+++ b/dev-build/samurai/samurai-9999.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="ninja-compatible build tool written in C"
+HOMEPAGE="https://github.com/michaelforney/samurai"
+if [[ "${PV}" == *9999 ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/michaelforney/samurai.git"
+else
+ SRC_URI="https://github.com/michaelforney/samurai/releases/download/${PV}/${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86"
+fi
+
+LICENSE="ISC Apache-2.0 MIT"
+SLOT="0"
+
+src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install
+ dodoc README.md
+}