Bug 664080 - math lib functions no longer work
math lib functions no longer work
Product: Fedora
Classification: Fedora
Component: bc (Show other bugs)
Unspecified Unspecified
low Severity high
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-12-17 18:29 EST by Pádraig Brady
Modified: 2010-12-24 19:26 EST (History)
1 user (show)

See Also:
Fixed In Version: bc-1.06.95-2.fc14
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-12-24 19:26:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pádraig Brady 2010-12-17 18:29:21 EST
$ echo "s(1);e(1)" | /f14/usr/bin/bc -l
$ echo "s(1);e(1)" | /f11/usr/bin/bc -l
Comment 1 Ondrej Vasik 2010-12-18 02:51:06 EST
Thanks for report - strange, can't reproduce here...

$ rpm -q bc

$ echo "s(1);e(1)" | bc -l

And that's the same version which is in f14. Some specific arch?
Comment 2 Pádraig Brady 2010-12-21 06:31:17 EST
I had a quick look at this again...

It doesn't look to be an issue specific to the math lib (-l option)
as in the following example, n is not defined and should give a
different error and e is defined and should not give error.

$ echo "v=n(1);v=e(1)" | LANG=C /usr/bin/bc -l
(standard_in) 1: Assignment of a void expression
(standard_in) 2: Assignment of a void expression

That along with the fact that I also have it working
on another i686 F14 box with same sw versions, suggested
to me something low level. So I rebuilt the binary
(which still had the issue), and ran it under an F11 chroot
and it was OK!

That suggests to me a glibc issue?

$ rpm -q gcc kernel glibc
$ uname -a
Linux #1 SMP Fri Dec 3 12:35:42 UTC 2010 i686 i686 i386 GNU/Linux
$ grep -E "(model|flags)" /proc/cpuinfo 
model           : 13
model name      : Intel(R) Pentium(R) M processor 1.70GHz
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts est tm2

I'll try replacing memcpy and strcmp etc. this evening...
Comment 3 Ondrej Vasik 2010-12-21 08:14:18 EST
glibc - maybe ... could you please try to recompile bc srpm on your FC-14 machine and check it again? Maybe bc just needs to be rebuilt in F14...
Comment 4 Pádraig Brady 2010-12-21 11:01:07 EST
Sorry for being unclear. When I said "So I rebuilt the binary" above,
that was the rpm. Then I rebuilt a version without readline for
testing in the F11 chroot (with older readline)
Comment 5 Pádraig Brady 2010-12-21 18:55:21 EST
Found the issue in bc with a bit of thought and valgrind...
I'll send the fix upstream, but there's not been a release
for 4 years, so I'd apply it locally anyway. cheers.

--- storage.c.orig      2010-12-21 19:43:14.663540110 +0000
+++ storage.c   2010-12-21 19:42:01.392540111 +0000
@@ -99,6 +99,7 @@
       f = &functions[indx];
       f->f_defined = FALSE;
+      f->f_void = FALSE;
       f->f_body = (char *) bc_malloc (BC_START_SIZE);
       f->f_body_size = BC_START_SIZE;
       f->f_code_size = 0;
Comment 6 Ondrej Vasik 2010-12-22 00:24:14 EST
Thanks for the patch, sure, upstream seems to be dead (1.06.95 for years), I'll do an update soon.
Comment 7 Fedora Update System 2010-12-22 04:49:54 EST
bc-1.06.95-2.fc14 has been submitted as an update for Fedora 14.
Comment 8 Fedora Update System 2010-12-22 14:54:02 EST
bc-1.06.95-2.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update bc'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/bc-1.06.95-2.fc14
Comment 9 Fedora Update System 2010-12-24 19:26:49 EST
bc-1.06.95-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.