From 8ae7f06f345a233b07eeb95ffe761dbe92aa0674 Mon Sep 17 00:00:00 2001 From: kzak Date: Thu, 22 Dec 2005 18:48:39 +0000 Subject: [PATCH] minor paches from upstream --- gawk-3.1.5-binmode.patch | 16 ++++++++++++++++ gawk-3.1.5-num2str.patch | 37 +++++++++++++++++++++++++++++++++++++ gawk.spec | 12 ++++++++++-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 gawk-3.1.5-binmode.patch create mode 100644 gawk-3.1.5-num2str.patch diff --git a/gawk-3.1.5-binmode.patch b/gawk-3.1.5-binmode.patch new file mode 100644 index 0000000..4516700 --- /dev/null +++ b/gawk-3.1.5-binmode.patch @@ -0,0 +1,16 @@ + + * eval.c (set_BINMODE): Fix logic of test for no numeric value. + Makes `gawk -v BINMODE=1 ...' work again. Thanks to Eli Zaretskii + for pointing out the problem. + +--- gawk-3.1.5/eval.c.binmode 2005-12-22 19:05:32.000000000 +0100 ++++ gawk-3.1.5/eval.c 2005-12-22 19:06:40.000000000 +0100 +@@ -2167,7 +2167,7 @@ + } + } + +- if (! digits || (BINMODE_node->var_value->flags & MAYBE_NUM) == 0) { ++ if (! digits && (BINMODE_node->var_value->flags & MAYBE_NUM) == 0) { + BINMODE = 0; + if (strcmp(p, "r") == 0) + BINMODE = 1; diff --git a/gawk-3.1.5-num2str.patch b/gawk-3.1.5-num2str.patch new file mode 100644 index 0000000..8d4868b --- /dev/null +++ b/gawk-3.1.5-num2str.patch @@ -0,0 +1,37 @@ +--- gawk-3.1.5/node.c.num2str 2005-07-26 20:07:43.000000000 +0200 ++++ gawk-3.1.5/node.c 2005-12-22 19:41:55.000000000 +0100 +@@ -151,6 +151,7 @@ + register char *sp = buf; + double val; + char *orig, *trans, save; ++ register long num; + + if (! do_traditional && (s->flags & INTLSTR) != 0) { + save = s->stptr[s->stlen]; +@@ -163,9 +164,12 @@ + return tmp_string(trans, strlen(trans)); + } + +- /* not an integral value, or out of range */ +- if ((val = double_to_int(s->numbr)) != s->numbr +- || val < LONG_MIN || val > LONG_MAX) { ++ /* conversion to long overflows, or out of range, or not integral */ ++ val = double_to_int(s->numbr); ++ num = (long) val; ++ if ( (s->numbr > 0 && num < 0) ++ || (s->numbr < 0 && num > 0) ++ || val < LONG_MIN || val > LONG_MAX || val != s->numbr) { + /* + * Once upon a time, if GFMT_WORKAROUND wasn't defined, + * we just blindly did this: +@@ -199,9 +203,7 @@ + + goto no_malloc; + } else { +- /* integral value */ +- /* force conversion to long only once */ +- register long num = (long) val; ++ /* integral value, in range, too! */ + if (num < NVAL && num >= 0) { + sp = (char *) values[num]; + s->stlen = 1; diff --git a/gawk.spec b/gawk.spec index 3e3bbcb..8063c51 100644 --- a/gawk.spec +++ b/gawk.spec @@ -1,7 +1,7 @@ Summary: The GNU version of the awk text processing utility. Name: gawk Version: 3.1.5 -Release: 4.1 +Release: 5 License: GPL Group: Applications/Text Source0: ftp://ftp.gnu.org/gnu/gawk/gawk-%{version}.tar.bz2 @@ -13,6 +13,8 @@ Buildroot: %{_tmppath}/%{name}-root Patch1: gawk-3.1.3-getpgrp_void.patch Patch2: gawk-3.1.5-free.patch Patch3: gawk-3.1.5-fieldwidths.patch +Patch4: gawk-3.1.5-binmode.patch +Patch5: gawk-3.1.5-num2str.patch %description The gawk packages contains the GNU version of awk, a text processing @@ -27,6 +29,8 @@ considered to be a standard Linux tool for processing text. %patch1 -p1 -b .getpgrp_void %patch2 -p1 -b .free %patch3 -p1 -b .fieldwidths +%patch4 -p1 -b .binmode +%patch5 -p1 -b .num2str %build %configure @@ -75,12 +79,16 @@ fi %{_datadir}/awk %changelog +* Thu Dec 22 2005 Karel Zak 3.1.5-5 +- fix "gawk -v BINMODE=1" (patch by Aharon Robbins) +- fix conversion from large number to string (patch by Aharon Robbins) + * Fri Dec 09 2005 Jesse Keating - rebuilt * Sun Oct 9 2005 Karel Zak 3.1.5-4 - fix off-by-one error in assignment of sentinel value at - end of FIELDWIDTHS array. (patch by - upstream - Aharon Robbins) + end of FIELDWIDTHS array. (patch by Aharon Robbins) * Tue Sep 27 2005 Karel Zak 3.1.5-3 - fix #169374 - Invalid Free (patch by Aharon Robbins)