Bug 10210

Summary: fscanf fails to convert %11f correctly
Product: [Retired] Red Hat Linux Reporter: jimabbate <jim>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 6.0CC: jim
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-14 21:22:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jimabbate 2000-03-16 20:04:24 UTC
Using the following input for the fscanf: "test.file":
-.10000E+020.20000E+000.30000E-010.40000E-010.50000E-010.60000E-01

And running the following C program:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<strings.h>
#include <ctype.h>


int main() {

  FILE *fp;
  float fdata;
  int i;

  fp = fopen("test.file", "r");
  if (NULL == fp) {
    printf("\n Open Failed\n");
    exit (0);
  }

  for (i = 0; i < 6; i++) {
    fscanf(fp, "%11f", &fdata);
    printf("\n fdata=%g", fdata);
  }
  fclose(fp);
  exit (0);
}


YIELDS the following incorrect results:

 fdata=-10
 fdata=0.2
 fdata=3e-11
 fdata=4e-11
 fdata=5e-11
 fdata=6e-11
 fdata=0.07

Running the same program on Solaris, HP and Slackware 3.4 works correctly
Yielding:
 fdata=-10
 fdata=0.2
 fdata=0.03
 fdata=0.04
 fdata=0.05
 fdata=0.06
 fdata=0.07

Comment 1 Cristian Gafton 2000-05-22 14:52:59 UTC
assign to jakub

Comment 2 jimabbate 2000-06-29 05:41:11 UTC
We really need a fix for this problem A.S.A.P  

The workaround is adding over 25% to our total run time!!

When can I expect this bug to be fixed?

PLEASE RESPOND!!

Thanks,
  Jim

Comment 3 jimabbate 2000-08-14 21:22:45 UTC
Another 6 weeks have passed and still nothing!!!

I installed Version 6.2 and it works for the simple test case given originally:
-.10000E+020.20000E+000.30000E-010.40000E-010.50000E-010.60000E-01

However, it still doesn't work correctly in the general case because when I took
the workaround out, our test cases all failed miserably.  Maybe you should call
me when you get ready to work on it and I'll give you a new test case that
breaks it. (503) 672-8717

Jim Abbate

BTW:  If Fluence took this long to respond to bugs, we would have been laughed
out of the businees a long time ago.

Comment 4 Jakub Jelinek 2000-08-15 04:55:09 UTC
I have fixed this in glibc 2.1.92 (thanks for the report), I'm just not sure this is worth issuing glibc 2.1.3 updates because of it.
If you want, I can mail you the patch and you can rebuild glibc yoursef, or you can use glibc from rawhide. Let me know.

Comment 5 jimabbate 2000-10-09 17:45:03 UTC
Thanks for fixing this bug.  I need the fix for this problem now since we are
ready to release a new version of our software.  What do you mean by "I can use
the glibc from rawhide?"  How do I get this?  Is it better to try to rebuild
glibc with the patch, myself?  How do I do that.

Thanks,
  Jim