minor paches from upstream

This commit is contained in:
kzak 2005-12-22 18:48:39 +00:00
parent d6ea928029
commit 8ae7f06f34
3 changed files with 63 additions and 2 deletions

16
gawk-3.1.5-binmode.patch Normal file
View File

@ -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
<eliz@gnu.org> 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;

37
gawk-3.1.5-num2str.patch Normal file
View File

@ -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;

View File

@ -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 <kzak@redhat.com> 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 <jkeating@redhat.com>
- rebuilt
* Sun Oct 9 2005 Karel Zak <kzak@redhat.com> 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 <kzak@redhat.com> 3.1.5-3
- fix #169374 - Invalid Free (patch by Aharon Robbins)