Bug 664080 - math lib functions no longer work
Summary: math lib functions no longer work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bc
Version: 14
Hardware: Unspecified
OS: Unspecified
low
high
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-12-17 23:29 UTC by Pádraig Brady
Modified: 2010-12-25 00:26 UTC (History)
1 user (show)

Fixed In Version: bc-1.06.95-2.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-12-25 00:26:54 UTC
Type: ---


Attachments (Terms of Use)

Description Pádraig Brady 2010-12-17 23:29:21 UTC
$ echo "s(1);e(1)" | /f14/usr/bin/bc -l
$ echo "s(1);e(1)" | /f11/usr/bin/bc -l
.84147098480789650665
2.71828182845904523536

Comment 1 Ondrej Vasik 2010-12-18 07:51:06 UTC
Thanks for report - strange, can't reproduce here...

$ rpm -q bc
bc-1.06.95-1.fc12.i686

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

And that's the same version which is in f14. Some specific arch?

Comment 2 Pádraig Brady 2010-12-21 11:31:17 UTC
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
gcc-4.5.1-4.fc14.i686
kernel-2.6.35.9-64.fc14.i686
glibc-2.12.90-21.i686
$ uname -a
Linux 2.6.35.9-64.fc14.i686 #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 13:14:18 UTC
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 16:01:07 UTC
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 23:55:21 UTC
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 05:24:14 UTC
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 09:49:54 UTC
bc-1.06.95-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/bc-1.06.95-2.fc14

Comment 8 Fedora Update System 2010-12-22 19:54:02 UTC
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-25 00:26:49 UTC
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.