From e3d748a338dcb52a4916e867ed336f0deb9d2a29 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 6 Apr 2017 15:02:39 +0200 Subject: [PATCH] bc: hotfix for read() This fixes the read() function that doesn't terminate on newlines in bc 1.07 (an upstream bug has been reported). Patch due to educated guesswork on the diff between 1.06.95 and 1.07. This fixes building Linux 4.10 with bc. --- srcpkgs/bc/patches/read.patch | 44 +++++++++++++++++++++++++++++++++++ srcpkgs/bc/template | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/bc/patches/read.patch diff --git a/srcpkgs/bc/patches/read.patch b/srcpkgs/bc/patches/read.patch new file mode 100644 index 00000000000..f45a2b0d2b7 --- /dev/null +++ b/srcpkgs/bc/patches/read.patch @@ -0,0 +1,44 @@ +--- bc/execute.c ++++ bc/execute.c +@@ -638,19 +638,19 @@ push_constant (int (*in_char)(VOID), int conv_base) + } + + /* Check for the special case of a single digit. */ +- if (in_ch < 36) ++ if (in_ch < 16) + { + first_ch = in_ch; + in_ch = in_char(); +- if (in_ch < 36 && first_ch >= conv_base) ++ if (in_ch < 16 && first_ch >= conv_base) + first_ch = conv_base - 1; + bc_int2num (&build, (int) first_ch); + } + + /* Convert the integer part. */ +- while (in_ch < 36) ++ while (in_ch < 16) + { +- if (in_ch < 36 && in_ch >= conv_base) in_ch = conv_base-1; ++ if (in_ch < 16 && in_ch >= conv_base) in_ch = conv_base-1; + bc_multiply (build, mult, &result, 0); + bc_int2num (&temp, (int) in_ch); + bc_add (result, temp, &build, 0); +@@ -665,7 +665,7 @@ push_constant (int (*in_char)(VOID), int conv_base) + divisor = bc_copy_num (_one_); + result = bc_copy_num (_zero_); + digits = 0; +- while (in_ch < 36) ++ while (in_ch < 16) + { + bc_multiply (result, mult, &result, 0); + bc_int2num (&temp, (int) in_ch); +@@ -673,7 +673,7 @@ push_constant (int (*in_char)(VOID), int conv_base) + bc_multiply (divisor, mult, &divisor, 0); + digits++; + in_ch = in_char(); +- if (in_ch < 36 && in_ch >= conv_base) in_ch = conv_base-1; ++ if (in_ch < 16 && in_ch >= conv_base) in_ch = conv_base-1; + } + bc_divide (result, divisor, &result, digits); + bc_add (build, result, &build, 0); diff --git a/srcpkgs/bc/template b/srcpkgs/bc/template index 76c53b8d7ea..354a22a2356 100644 --- a/srcpkgs/bc/template +++ b/srcpkgs/bc/template @@ -1,7 +1,7 @@ # Template file for 'bc' pkgname=bc version=1.07 -revision=1 +revision=2 build_style=gnu-configure configure_args="--with-readline" hostmakedepends="ed flex"