# ChangeLog for sys-apps/gawk
-# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/ChangeLog,v 1.97 2006/11/05 09:13:06 grobian Exp $
+# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/ChangeLog,v 1.98 2007/01/12 06:16:53 vapier Exp $
+
+*gawk-3.1.5-r3 (12 Jan 2007)
+
+ 12 Jan 2007; Mike Frysinger <vapier@gentoo.org>
+ +files/gawk-3.1.5-freewstr.patch, +files/gawk-3.1.5-wconcat.patch,
+ +gawk-3.1.5-r3.ebuild:
+ Grab some patches from Fedora to fixup double free #135931 by Georgi Georgiev.
05 Nov 2006; Fabian Groffen <grobian@gentoo.org> gawk-3.1.5-r1.ebuild,
gawk-3.1.5-r2.ebuild:
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
AUX filefuncs/Makefile 1212 RMD160 7b94f136f4a1e5cbfeade53c952c353378584c22 SHA1 e23965d28e8ae856b20211faedaca22cee613c11 SHA256 954bc6e837240b8d756cf6bd1460a24cae2a1cc5c738daf53746a0cff23791a1
MD5 bcc8ea75aa8f87927bb5e498f4222d2e files/filefuncs/Makefile 1212
RMD160 7b94f136f4a1e5cbfeade53c952c353378584c22 files/filefuncs/Makefile 1212
MD5 1088ba2d88976e2e9049a87f6f264ce6 files/gawk-3.1.5-fieldwidths.patch 1009
RMD160 8780aa76799f29b2050ae55d4587bf0e549158e8 files/gawk-3.1.5-fieldwidths.patch 1009
SHA256 09689141e2c391e8b48208a59f9440b3d7da127ee3ddf6cc70c2cbbc2867a84b files/gawk-3.1.5-fieldwidths.patch 1009
+AUX gawk-3.1.5-freewstr.patch 4392 RMD160 4bb7a4b02a6c2fe58dc9db98ae9b1bd7181f3c70 SHA1 ffe6b787cdd04b26753cf8d36a9ee4b03f6f3944 SHA256 6c2a8314dc7860f0a584025834597add02dbbf4b1268dd9ab9260cea393d13c5
+MD5 916a051c8c4adea14472e31af8268aee files/gawk-3.1.5-freewstr.patch 4392
+RMD160 4bb7a4b02a6c2fe58dc9db98ae9b1bd7181f3c70 files/gawk-3.1.5-freewstr.patch 4392
+SHA256 6c2a8314dc7860f0a584025834597add02dbbf4b1268dd9ab9260cea393d13c5 files/gawk-3.1.5-freewstr.patch 4392
AUX gawk-3.1.5-gcc4.patch 826 RMD160 a68e7ed7c70aa6be454961aa25903fe236650227 SHA1 8908a11d8e0e3d0ee1cc5ae5b9c31ebc0341cdc8 SHA256 7b7d37a6ecb51300f46ad611d486a074eb522dabb949e500664943df7f52b0e3
MD5 499e2881f167a17f2123ca338836e91d files/gawk-3.1.5-gcc4.patch 826
RMD160 a68e7ed7c70aa6be454961aa25903fe236650227 files/gawk-3.1.5-gcc4.patch 826
MD5 a785b90927a488ae17245a5a79907587 files/gawk-3.1.5-utf-8-strcat.patch 1456
RMD160 4104db0c27585f6c160adeca9b432ff5f8932965 files/gawk-3.1.5-utf-8-strcat.patch 1456
SHA256 a6e264d4949cd80e22a2b4e107f0d6d935ce4d2b683c283949c9c4519e370c2e files/gawk-3.1.5-utf-8-strcat.patch 1456
+AUX gawk-3.1.5-wconcat.patch 495 RMD160 29f5eea5b300d8efc482e960b257292e5e5b19f8 SHA1 a40e527ef2741d8dea4e481852f887097dd2c921 SHA256 bc812044e12c291c0419853e3862e5dad60c17bfee8cffeb09135995b0694315
+MD5 786426bddc259cab7e222b27d59302a4 files/gawk-3.1.5-wconcat.patch 495
+RMD160 29f5eea5b300d8efc482e960b257292e5e5b19f8 files/gawk-3.1.5-wconcat.patch 495
+SHA256 bc812044e12c291c0419853e3862e5dad60c17bfee8cffeb09135995b0694315 files/gawk-3.1.5-wconcat.patch 495
DIST gawk-3.1.5.tar.gz 2310919 RMD160 8d875f4ea9e9ef5c932468cf43c691f6e082b197 SHA1 6cb385b4bc33780a5a4288b787523cbd4a30a900 SHA256 463dcb9d0ca398b1d4f5a332f6cd9cec56441265fca616f2ea1b44d459e9f0f8
-EBUILD gawk-3.1.5-r1.ebuild 3245 RMD160 130dce0b97fdf329a53b7d1ba0e2c8ac9cb96519 SHA1 041efa33ee46815604c7f7610a2ba54cc80c77d3 SHA256 5783c348e48fffdfc5d21dcbe04b89026800011c010f4136c461d474120fe8ae
-MD5 4b4a77b370e1e2bd62809408134c41d6 gawk-3.1.5-r1.ebuild 3245
-RMD160 130dce0b97fdf329a53b7d1ba0e2c8ac9cb96519 gawk-3.1.5-r1.ebuild 3245
-SHA256 5783c348e48fffdfc5d21dcbe04b89026800011c010f4136c461d474120fe8ae gawk-3.1.5-r1.ebuild 3245
EBUILD gawk-3.1.5-r2.ebuild 3409 RMD160 c07761af30e0785d013ba8fd90e50215f4bf9de8 SHA1 297488ee22b67db2b64060cb44a902b4fbf7af56 SHA256 cbc9efeb7d177eea4f7ec31e08a0c71b82b605ff9bde9686efc1b36e555cdaf4
MD5 a802584e4ab165fb8f121968d6c4357b gawk-3.1.5-r2.ebuild 3409
RMD160 c07761af30e0785d013ba8fd90e50215f4bf9de8 gawk-3.1.5-r2.ebuild 3409
SHA256 cbc9efeb7d177eea4f7ec31e08a0c71b82b605ff9bde9686efc1b36e555cdaf4 gawk-3.1.5-r2.ebuild 3409
-MISC ChangeLog 14265 RMD160 3528ecf11c44948364549e79d8c818ec8580c63b SHA1 750377fb2a1ef8935931e65d660f13c947c27a9e SHA256 87145b23639ceb26e7d62a90a8ad09ace12223172c998d162bc03c90ac6a3533
-MD5 af1bb2976428ec03c7a1435e322c9446 ChangeLog 14265
-RMD160 3528ecf11c44948364549e79d8c818ec8580c63b ChangeLog 14265
-SHA256 87145b23639ceb26e7d62a90a8ad09ace12223172c998d162bc03c90ac6a3533 ChangeLog 14265
+EBUILD gawk-3.1.5-r3.ebuild 3348 RMD160 8006af7965f1ab18718728c3c32e830e4908ae2a SHA1 ce29a47d280a91e267f81ff782dd0ae56442a2dc SHA256 c329cd41d99f1b51b2d69036afb7c0c8ef9b95db4c86a93c65f5b715e0d2632a
+MD5 0cdb43d900d01c7519b2f580e1eab696 gawk-3.1.5-r3.ebuild 3348
+RMD160 8006af7965f1ab18718728c3c32e830e4908ae2a gawk-3.1.5-r3.ebuild 3348
+SHA256 c329cd41d99f1b51b2d69036afb7c0c8ef9b95db4c86a93c65f5b715e0d2632a gawk-3.1.5-r3.ebuild 3348
+MISC ChangeLog 14520 RMD160 366cf4462466d102ca522a7843cac67ccc6d773d SHA1 592988080a10a6ec8d8078abf8e715eb1da124a5 SHA256 6a4c7e86c76482abe992d39179ef54ea1f8cb6952d16548f954e2c38cb72b3a7
+MD5 66f765670d244e28ef9f4c8279f21320 ChangeLog 14520
+RMD160 366cf4462466d102ca522a7843cac67ccc6d773d ChangeLog 14520
+SHA256 6a4c7e86c76482abe992d39179ef54ea1f8cb6952d16548f954e2c38cb72b3a7 ChangeLog 14520
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 metadata.xml 164
SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 metadata.xml 164
-MD5 5717d8332bd2e98dbded1334cc76bee2 files/digest-gawk-3.1.5-r1 235
-RMD160 3d116e6731687336128135022efa9fa0e506dbad files/digest-gawk-3.1.5-r1 235
-SHA256 01e8243cf09dada7e4b9a224466042712149a3e32a8941dd0c2319064daf6e3b files/digest-gawk-3.1.5-r1 235
MD5 5717d8332bd2e98dbded1334cc76bee2 files/digest-gawk-3.1.5-r2 235
RMD160 3d116e6731687336128135022efa9fa0e506dbad files/digest-gawk-3.1.5-r2 235
SHA256 01e8243cf09dada7e4b9a224466042712149a3e32a8941dd0c2319064daf6e3b files/digest-gawk-3.1.5-r2 235
+MD5 5717d8332bd2e98dbded1334cc76bee2 files/digest-gawk-3.1.5-r3 235
+RMD160 3d116e6731687336128135022efa9fa0e506dbad files/digest-gawk-3.1.5-r3 235
+SHA256 01e8243cf09dada7e4b9a224466042712149a3e32a8941dd0c2319064daf6e3b files/digest-gawk-3.1.5-r3 235
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.1 (GNU/Linux)
+
+iD8DBQFFpyfm8bi6rjpTunYRAhlhAKCYxKGaNkRSlf305UuY313BPCzF0gCfWhyj
+zkdn2tU5/nJqmbalQc86UmQ=
+=1jAr
+-----END PGP SIGNATURE-----
--- /dev/null
+MD5 4760325489479cac17fe0114b8f62f30 gawk-3.1.5.tar.gz 2310919
+RMD160 8d875f4ea9e9ef5c932468cf43c691f6e082b197 gawk-3.1.5.tar.gz 2310919
+SHA256 463dcb9d0ca398b1d4f5a332f6cd9cec56441265fca616f2ea1b44d459e9f0f8 gawk-3.1.5.tar.gz 2310919
--- /dev/null
+--- gawk-3.1.5/builtin.c.freewstr 2005-07-26 20:07:43.000000000 +0200
++++ gawk-3.1.5/builtin.c 2007-01-08 13:29:45.000000000 +0100
+@@ -2089,9 +2089,9 @@
+ }
+
+ free(buf);
+- if (wc_indices != NULL)
+- free(wc_indices);
+ }
++ if (wc_indices != NULL)
++ free(wc_indices);
+ } else { /* match failed */
+ rstart = 0;
+ rlength = -1;
+@@ -2462,6 +2462,8 @@
+ free(t->stptr);
+ t->stptr = buf;
+ t->stlen = textlen;
++ free_wstr(t);
++ t->flags &= ~(NUMCUR|NUMBER);
+
+ free_temp(s);
+ if (matches > 0 && lhs) {
+@@ -2471,7 +2473,6 @@
+ }
+ if (after_assign != NULL)
+ (*after_assign)();
+- t->flags &= ~(NUMCUR|NUMBER);
+ }
+ if (mb_indices != NULL)
+ free(mb_indices);
+--- gawk-3.1.5/awk.h.freewstr 2005-07-26 20:07:43.000000000 +0200
++++ gawk-3.1.5/awk.h 2007-01-08 12:31:26.000000000 +0100
+@@ -1166,6 +1166,9 @@
+ #define force_wstring(n) str2wstr(n, NULL)
+ extern const wchar_t *wstrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len));
+ extern const wchar_t *wcasestrstr P((const wchar_t *haystack, size_t hs_len, const wchar_t *needle, size_t needle_len));
++extern void free_wstr P((NODE *n));
++#else
++#define free_wstr(NODE) /* empty */
+ #endif
+ /* re.c */
+ extern Regexp *make_regexp P((const char *s, size_t len, int ignorecase, int dfa));
+--- gawk-3.1.5/node.c.freewstr 2007-01-08 12:31:26.000000000 +0100
++++ gawk-3.1.5/node.c 2007-01-08 12:41:48.000000000 +0100
+@@ -218,15 +218,7 @@
+ no_malloc:
+ s->stref = 1;
+ s->flags |= STRCUR;
+-#if defined MBS_SUPPORT
+- if ((s->flags & WSTRCUR) != 0) {
+- assert(s->wstptr != NULL);
+- free(s->wstptr);
+- s->wstptr = NULL;
+- s->wstlen = 0;
+- s->flags &= ~WSTRCUR;
+- }
+-#endif
++ free_wstr(s);
+ return s;
+ }
+
+@@ -289,8 +281,14 @@
+ *r = *n;
+ r->flags &= ~(PERM|TEMP|FIELD);
+ r->flags |= MALLOC;
+-#if defined MBS_SUPPORT
++#ifdef MBS_SUPPORT
++ /*
++ * DON'T call free_wstr(r) here!
++ * r->wstptr still points at n->wstptr's value, and we
++ * don't want to free it!
++ */
+ r->wstptr = NULL;
++ r->wstlen = 0;
+ #endif /* defined MBS_SUPPORT */
+ if (n->type == Node_val && (n->flags & STRCUR) != 0) {
+ r->stref = 1;
+@@ -346,11 +344,7 @@
+ r->stref = 1;
+ r->stptr = NULL;
+ r->stlen = 0;
+-#if defined MBS_SUPPORT
+- r->wstptr = NULL;
+- r->wstlen = 0;
+- r->flags &= ~WSTRCUR;
+-#endif /* MBS_SUPPORT */
++ free_wstr(r);
+ #endif /* GAWKDEBUG */
+ return r;
+ }
+@@ -365,10 +359,11 @@
+ getnode(r);
+ r->type = Node_val;
+ r->flags = (STRING|STRCUR|MALLOC);
+-#if defined MBS_SUPPORT
++#ifdef MBS_SUPPORT
+ r->wstptr = NULL;
+ r->wstlen = 0;
+-#endif
++#endif /* defined MBS_SUPPORT */
++
+ if (flags & ALREADY_MALLOCED)
+ r->stptr = s;
+ else {
+@@ -512,20 +507,13 @@
+ return;
+ }
+ free(tmp->stptr);
+-#if defined MBS_SUPPORT
+- if (tmp->wstptr != NULL) {
+- assert((tmp->flags & WSTRCUR) != 0);
+- free(tmp->wstptr);
+- }
+- tmp->flags &= ~WSTRCUR;
+- tmp->wstptr = NULL;
+- tmp->wstlen = 0;
+-#endif
++ free_wstr(tmp);
+ }
+ freenode(tmp);
+ return;
+ }
+ if ((tmp->flags & FIELD) != 0) {
++ free_wstr(tmp);
+ freenode(tmp);
+ return;
+ }
+@@ -708,11 +696,8 @@
+ fall through and recompute to fill in the array */
+ }
+
+- if (n->wstptr != NULL) {
+- free(n->wstptr);
+- n->wstptr = NULL;
+- n->wstlen = 0;
+- }
++ if (n->wstptr != NULL)
++ free_wstr(n);
+
+ /*
+ * After consideration and consultation, this
+@@ -777,6 +762,20 @@
+ return n;
+ }
+
++/* free_wstr --- release the wide string part of a node */
++
++void
++free_wstr(NODE *n)
++{
++ if ((n->flags & WSTRCUR) != 0) {
++ assert(n->wstptr != NULL);
++ free(n->wstptr);
++ n->wstptr = NULL;
++ n->wstlen = 0;
++ n->flags &= ~WSTRCUR;
++ }
++}
++
+ #if 0
+ static void
+ dump_wstr(FILE *fp, const wchar_t *str, size_t len)
+@@ -839,11 +838,10 @@
+ h = towlower(*start);
+ n = towlower(needle[j]);
+ if (h != n)
+- goto out;
++ continue;
+ }
+ return haystack + i;
+ }
+-out: ;
+ }
+
+ return NULL;
+--- gawk-3.1.5/eval.c.freewstr 2007-01-08 12:31:26.000000000 +0100
++++ gawk-3.1.5/eval.c 2007-01-08 12:31:26.000000000 +0100
+@@ -1176,13 +1176,7 @@
+ memcpy(l->stptr + l->stlen, r->stptr, r->stlen);
+ l->stlen += r->stlen;
+ l->stptr[l->stlen] = '\0';
+-#if defined MBS_SUPPORT
+- if (r->wstptr != NULL)
+- free(r->wstptr);
+- r->wstptr = NULL;
+- r->wstlen = 0;
+- r->flags &= ~WSTRCUR;
+-#endif /* MBS_SUPPORT */
++ free_wstr(l);
+ } else {
+ char *nval;
+ size_t nlen = l->stlen + r->stlen + 2;
--- /dev/null
+--- gawk-3.1.5/eval.c.wconcat 2006-02-14 09:40:54.000000000 +0100
++++ gawk-3.1.5/eval.c 2006-02-14 09:43:33.000000000 +0100
+@@ -1176,6 +1176,13 @@
+ memcpy(l->stptr + l->stlen, r->stptr, r->stlen);
+ l->stlen += r->stlen;
+ l->stptr[l->stlen] = '\0';
++#if defined MBS_SUPPORT
++ if (r->wstptr != NULL)
++ free(r->wstptr);
++ r->wstptr = NULL;
++ r->wstlen = 0;
++ r->flags &= ~WSTRCUR;
++#endif /* MBS_SUPPORT */
+ } else {
+ char *nval;
+ size_t nlen = l->stlen + r->stlen + 2;
--- /dev/null
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/gawk/gawk-3.1.5-r3.ebuild,v 1.1 2007/01/12 06:16:53 vapier Exp $
+
+inherit eutils toolchain-funcs multilib
+
+DESCRIPTION="GNU awk pattern-matching language"
+HOMEPAGE="http://www.gnu.org/software/gawk/gawk.html"
+SRC_URI="mirror://gnu/gawk/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="nls"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+SFFS=${WORKDIR}/filefuncs
+
+src_unpack() {
+ unpack ${P}.tar.gz
+
+ # Copy filefuncs module's source over ...
+ cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed"
+
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-core.patch
+ epatch "${FILESDIR}"/${P}-gcc4.patch
+ epatch "${FILESDIR}"/${P}-autotools-crap.patch #139397
+ # Patches from Fedora
+ epatch "${FILESDIR}"/${PN}-3.1.3-getpgrp_void.patch
+ epatch "${FILESDIR}"/${P}-fieldwidths.patch #127163
+ epatch "${FILESDIR}"/${P}-binmode.patch
+ epatch "${FILESDIR}"/${P}-num2str.patch
+ epatch "${FILESDIR}"/${P}-internal.patch
+ epatch "${FILESDIR}"/${P}-numflags.patch
+ epatch "${FILESDIR}"/${P}-syntaxerror.patch
+ epatch "${FILESDIR}"/${P}-wconcat.patch
+ epatch "${FILESDIR}"/${P}-freewstr.patch #135931
+}
+
+src_compile() {
+ econf \
+ --bindir=/bin \
+ --libexec='$(libdir)/misc' \
+ $(use_enable nls) \
+ --enable-switch \
+ || die
+ emake || die "emake failed"
+
+ cd "${SFFS}"
+ emake CC=$(tc-getCC) || die "filefuncs emake failed"
+}
+
+src_install() {
+ make install DESTDIR="${D}" || die "install failed"
+ cd "${SFFS}"
+ make LIBDIR="$(get_libdir)" install || die "filefuncs install failed"
+
+ dodir /usr/bin
+ # In some rare cases, (p)gawk gets installed as (p)gawk- and not
+ # (p)gawk-${PV} ... Also make sure that /bin/(p)gawk is a symlink
+ # to /bin/(p)gawk-${PV}.
+ local binpath x
+ for x in gawk pgawk igawk ; do
+ [[ ${x} == "gawk" ]] \
+ && binpath="/bin" \
+ || binpath="/usr/bin"
+
+ if [[ -f ${D}/bin/${x} && ! -f ${D}/bin/${x}-${PV} ]] ; then
+ mv -f "${D}"/bin/${x} "${D}"/${binpath}/${x}-${PV}
+ elif [[ -f ${D}/bin/${x}- && ! -f ${D}/bin/${x}-${PV} ]] ; then
+ mv -f "${D}"/bin/${x}- "${D}"/${binpath}/${x}-${PV}
+ elif [[ ${binpath} == "/usr/bin" && -f ${D}/bin/${x}-${PV} ]] ; then
+ mv -f "${D}"/bin/${x}-${PV} "${D}"/${binpath}/${x}-${PV}
+ fi
+
+ rm -f "${D}"/bin/${x}
+ dosym ${x}-${PV} ${binpath}/${x}
+ [[ ${binpath} == "/usr/bin" ]] && dosym /usr/bin/${x}-${PV} /bin/${x}
+ done
+
+ rm -f "${D}"/bin/awk
+ dodir /usr/bin
+ # Compat symlinks
+ dosym /bin/gawk-${PV} /usr/bin/gawk
+ dosym gawk-${PV} /bin/awk
+ dosym /bin/gawk-${PV} /usr/bin/awk
+ [[ ${USERLAND} != "GNU" ]] && rm -f "${D}"/{,usr/}bin/awk{,-${PV}}
+
+ # Install headers
+ insinto /usr/include/awk
+ doins "${S}"/*.h || die "ins headers failed"
+ # We do not want 'acconfig.h' in there ...
+ rm -f "${D}"/usr/include/awk/acconfig.h
+
+ cd "${S}"
+ rm -f "${D}"/usr/share/man/man1/pgawk.1
+ dosym gawk.1.gz /usr/share/man/man1/pgawk.1.gz
+ [[ ${USERLAND} == "GNU" ]] && dosym gawk.1.gz /usr/share/man/man1/awk.1.gz
+ dodoc AUTHORS ChangeLog FUTURES LIMITATIONS NEWS PROBLEMS POSIX.STD README
+ docinto README_d
+ dodoc README_d/*
+ docinto awklib
+ dodoc awklib/ChangeLog
+ docinto pc
+ dodoc pc/ChangeLog
+ docinto posix
+ dodoc posix/ChangeLog
+}