summaryrefslogtreecommitdiff
path: root/sys-apps/nawk
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-10-17 10:00:35 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-10-17 10:00:35 +0100
commitcf89ca044e37f79e2329552cda857215f9824e11 (patch)
treea6720b1db82c94482ed8a998aa77650c5f723358 /sys-apps/nawk
parentcb627578a344c874750e23e7eb59b1acc85aa639 (diff)
gentoo auto-resync : 17:10:2023 - 10:00:35
Diffstat (limited to 'sys-apps/nawk')
-rw-r--r--sys-apps/nawk/Manifest2
-rw-r--r--sys-apps/nawk/files/nawk-20230909-big-endian.patch51
-rw-r--r--sys-apps/nawk/nawk-20230909-r1.ebuild61
3 files changed, 114 insertions, 0 deletions
diff --git a/sys-apps/nawk/Manifest b/sys-apps/nawk/Manifest
index 3027c5cf4c11..be83b8d5c43d 100644
--- a/sys-apps/nawk/Manifest
+++ b/sys-apps/nawk/Manifest
@@ -1,5 +1,7 @@
+AUX nawk-20230909-big-endian.patch 1661 BLAKE2B 7d67e8c1df3e67eadc226885959b79f0585c93753e3e74cdd8066bb8306f2a7fd8d8d5c032bc18d6d7c107a4ee4c587d8cff634d4a985ee2d677a06e02cb8f40 SHA512 f230e4c1a5d79de92da51fcabb4574c0e6ed7c6ad21af6f59dabae41d2563e8fc7b2c92924dea8e0aa432f31f0df5350e21fb4d0873104f6e99bd148abd06f78
DIST nawk-20220122.tar.gz 1832761 BLAKE2B f704ff9cf5012545ec3adc1887c0d43625d7e38e19589cba91fe31f664e72ccce20dee3f2484067a31af793be16439c1389603fbdb33c119efeafb18559a0d97 SHA512 46ab7936705288c9cd22867ad9f5b080ade67c4b05d674304e0e5cae8ea329420a9a46e3578bf3a014b7066a1185b7506b0f74445bb52aafb1090e7a82a5bf28
DIST nawk-20230909.tar.gz 1833391 BLAKE2B 1a8dc9805d144953d6ad5d0539847b1d83661a8e2c0e029e13201ee44f5f6a29cf487c4368c8578d01577b99349968415503fb0c2f7f8f37f4a55fb57cec2b07 SHA512 28687dfbd797fb1f758bd356824110602045b7249a41f47e2cda15ac3d256d57260f1fc74119dc30fbb0e909295bd676a52ec24d3b3cc35e417d46a1749f856f
EBUILD nawk-20220122-r1.ebuild 1223 BLAKE2B 085fb2b121a121d20152056dce2a244c25d380d90d61da7e62028f2d607155dbd050f98417e0c6d2824c3ddf2d9a8c5197c7091159f8baf035a0e73e90d725ec SHA512 bc40324399e6be4ef25b011e264861b88bf776c10cba6538d644ddd46034efc5ab5b7e148187cb1f391e023203b7796503121a7d906817ff569473c40f57aaea
+EBUILD nawk-20230909-r1.ebuild 1305 BLAKE2B 2b32d78724678581cb1ec38a6f9bbb7f4ad5df04bf663c3e66530915a15ca5f30bbbbbd7e8b947b75fee1538bd62bb942ac509b473939bebb8f1634c2f328ea2 SHA512 02ea5fdfb78df7cdb651b08df9433559f097b01eb6ce0da5c9bffd4c0219b46ebc1e6b2bf0c9c03514c6e714be28fa4413360b87a37ae2140afac233318ca686
EBUILD nawk-20230909.ebuild 1231 BLAKE2B 3c3d13a2e1d58127dce448c3716be61b29c921b80c01fe6554be424aaaf858e54b8b736684483e6bfea21c0053dbdd16466d8c7d49417c6e6c24433eb59da9e7 SHA512 c8be2b47a50c91f1bdb39377e5338f5043f132bc1ce3dd5941fed2901ae09ec7cd30468ba1ed0288376125f0cbf97d834d8b361c302393ff00831efed110c883
MISC metadata.xml 337 BLAKE2B 39b318d3780c5249fbf02ea024166015bb8d7798da072dbaf95318ce222f9722cf86d04e9a7c8c92c27377f5b6e09e2d8c11906c9d4e1977102ff6611f1ee6fa SHA512 8dd91d8652fa219ac793b361e5ee2bdc5337c4c098a851a1d19bf03cf2eb9a0c5ef7087f2b4ab7f51a0492ee03a7ea471f990a717e20f492dd9a57c1111237f6
diff --git a/sys-apps/nawk/files/nawk-20230909-big-endian.patch b/sys-apps/nawk/files/nawk-20230909-big-endian.patch
new file mode 100644
index 000000000000..b39e7b4bee62
--- /dev/null
+++ b/sys-apps/nawk/files/nawk-20230909-big-endian.patch
@@ -0,0 +1,51 @@
+https://github.com/onetrueawk/awk/pull/196
+
+From 75c017ca09a70e14a862f7285cf91bb87ec1f443 Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller@sudo.ws>
+Date: Mon, 18 Sep 2023 17:34:34 -0600
+Subject: [PATCH 1/2] Fix a bad cast to char * that causes incorrect results on
+ big endian.
+
+Now that awk stores chars as int we need to cast the Node * to int *.
+--- a/b.c
++++ b/b.c
+@@ -527,7 +527,7 @@ int first(Node *p) /* collects initially active leaves of p into setvec */
+ setvec[lp] = 1;
+ setcnt++;
+ }
+- if (type(p) == CCL && (*(char *) right(p)) == '\0')
++ if (type(p) == CCL && (*(int *) right(p)) == 0)
+ return(0); /* empty CCL */
+ return(1);
+ case PLUS:
+
+From 0048c96e94c732c6fb2ebe50eeb3450c1672fe0f Mon Sep 17 00:00:00 2001
+From: "Todd C. Miller" <Todd.Miller@sudo.ws>
+Date: Thu, 21 Sep 2023 11:20:16 -0600
+Subject: [PATCH 2/2] Use cclenter("") to construct an empty CCL, not
+ tostring("").
+
+We need to store a UTF-32 string, not a UTF-8 string, for consistency
+with the other CCL code. Fixes an out-of-bounds read of an empty
+CCL.
+--- a/b.c
++++ b/b.c
+@@ -945,7 +945,7 @@ Node *primary(void)
+ rtok = relex();
+ if (rtok == ')') { /* special pleading for () */
+ rtok = relex();
+- return unary(op2(CCL, NIL, (Node *) tostring("")));
++ return unary(op2(CCL, NIL, (Node *) cclenter("")));
+ }
+ np = regexp();
+ if (rtok == ')') {
+@@ -968,7 +968,7 @@ Node *concat(Node *np)
+ return (concat(op2(CAT, np, primary())));
+ case EMPTYRE:
+ rtok = relex();
+- return (concat(op2(CAT, op2(CCL, NIL, (Node *) tostring("")),
++ return (concat(op2(CAT, op2(CCL, NIL, (Node *) cclenter("")),
+ primary())));
+ }
+ return (np);
+
diff --git a/sys-apps/nawk/nawk-20230909-r1.ebuild b/sys-apps/nawk/nawk-20230909-r1.ebuild
new file mode 100644
index 000000000000..aa037df95f05
--- /dev/null
+++ b/sys-apps/nawk/nawk-20230909-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="Brian Kernighan's pattern scanning and processing language"
+HOMEPAGE="https://www.cs.princeton.edu/~bwk/btl.mirror/"
+SRC_URI="https://github.com/onetrueawk/awk/archive/${PV}.tar.gz -> ${P}.tar.gz"
+S="${WORKDIR}/awk-${PV}"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux"
+
+BDEPEND="
+ app-alternatives/yacc
+"
+
+DOCS=( README.md FIXES )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-20230909-big-endian.patch
+)
+
+src_compile() {
+ emake \
+ CC="$(tc-getCC)" \
+ HOSTCC="$(tc-getBUILD_CC)" \
+ CFLAGS="${CFLAGS}" \
+ CPPFLAGS="${CPPFLAGS} -DHAS_ISBLANK" \
+ ALLOC="${LDFLAGS}" \
+ YACC=$(type -p yacc) \
+ YFLAGS="-d -b awkgram"
+}
+
+src_install() {
+ newbin a.out "${PN}"
+ sed \
+ -e 's/awk/nawk/g' \
+ -e 's/AWK/NAWK/g' \
+ -e 's/Awk/Nawk/g' \
+ awk.1 > "${PN}".1 || die "manpage patch failed"
+ doman "${PN}.1"
+ einstalldocs
+}
+
+pkg_postinst() {
+ if has_version app-admin/eselect && has_version app-eselect/eselect-awk
+ then
+ eselect awk update ifunset
+ fi
+}
+
+pkg_postrm() {
+ if has_version app-admin/eselect && has_version app-eselect/eselect-awk
+ then
+ eselect awk update ifunset
+ fi
+}