summaryrefslogtreecommitdiff
path: root/dev-build/samurai
diff options
context:
space:
mode:
Diffstat (limited to 'dev-build/samurai')
-rw-r--r--dev-build/samurai/Manifest5
-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, 140 insertions, 0 deletions
diff --git a/dev-build/samurai/Manifest b/dev-build/samurai/Manifest
new file mode 100644
index 000000000000..1ed454c01d08
--- /dev/null
+++ b/dev-build/samurai/Manifest
@@ -0,0 +1,5 @@
+AUX samurai-1.2-null_pointer_fix.patch 2089 BLAKE2B f721cec4d42b4826ec52d4e88ee86b907956739f30427eeaee047eef8e59f953c1bcb2fda301cf3a8214c707954cbbb0abf0901c63ec557f4d9cc614962894d1 SHA512 5ead4b0aa47fd9c3bc84cf437744a36a9a1ed21b438883d32ab98b598c98a20561ba46954255553befdb9f46efa4f6251f73342de9000415f09bce63064e52eb
+DIST samurai-1.2.tar.gz 32709 BLAKE2B 86ed79f7d6ab492216cf3bf0e19ff8be8c1ca37e5c99de84b457875fa710d720624bd0de53105ed0b1d382c417aeb7397929cb9a35a8d1b36a11e053bf8d7ff5 SHA512 bbe6a582c34b04f1df53b76c1647aa3e03c4698ebf7591a203935f11ffa05971bbcb86dc1a8c06aeb904cdc741abb08918122810fc47216fed0a6d9f87fd1225
+EBUILD samurai-1.2-r2.ebuild 749 BLAKE2B fd215292da69e3afa669e0c51925ea53bd71c81267bde9ac80bd6a55cda1296a3832eae7d59c47ab2ca7472dc7a38948e182abe5e701264bcf5b58a227842dff SHA512 c1d98d5832894a25929e52373dd4596256b283cbd597ea3515f6c4a00c8f17b1fee4e5235e968de122959ecbd63833664d7e89ecf6f08843d9420f048866cad9
+EBUILD samurai-9999.ebuild 667 BLAKE2B d7cd61d295ddd710163d362dd208643574b0784fd1ff77ab6010a72a2fc6ba6ddf9b0f8cc0bca94444899401e7c6c07ac377ebce22827787b5682011456b480e SHA512 dc94ed93d609f510f30d0b15d98fab58da752d08301527b239d693c003a33dae86cbbb45ac16b3b41192b259d3b5df9882001fc0371227dc5cd60d95bb4bd44b
+MISC metadata.xml 454 BLAKE2B b3f71bd78021685a69254816df743ace390d3aadeaaf9adb1cdeb5f7c3f567623b863fe87b7b230e45efd65bb74b306e0615081f14d396882197c178eb2f77e7 SHA512 527fa97c53904b68ef8f182d6faf8c18116bf3b60099a1b0152a7326cbb372130bd2de0fda38c7ec66dac6d10dba9af29d50d1b98a12999108eab90cd5ed1b79
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
+}