Bug 54577

Summary: fscanf() != EOF for empty file
Product: [Retired] Red Hat Linux Reporter: Need Real Name <itsphone>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: fweimer
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: 2001-10-19 17:25:52 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:
Attachments:
Description Flags
source code that demonstrates EOF problem in fscanf none

Description Need Real Name 2001-10-12 20:22:40 UTC
Description of Problem:
fscanf does not return EOF if attempt to read fro 0 length file

Version-Release number of selected component (if applicable):
 rpm 2.1.19-14

How Reproducible:


Steps to Reproduce:
1. open file for writing, then close file
2. open file for read (filehandle != NULL)
3. fscanf(filehandle) returns 0 not EOF as expected

Actual Results:
returns 0

Expected Results:
expect EOF

Additional Information:
on linux6.2 fscanf returns EOF
feof(filehandle) is also wrong!
I'm new to Linux but have experience in C

Comment 1 Jakub Jelinek 2001-10-15 09:19:30 UTC
Can you come up with a testcase?
It depends on what arguments fscanf gets.

Comment 2 Need Real Name 2001-10-19 17:25:46 UTC
Created attachment 34422 [details]
source code that demonstrates EOF problem in fscanf

Comment 3 Jakub Jelinek 2001-10-19 20:28:04 UTC
What glibc do you use?
Under glibc-2.2.4-19 (which is the same source as 2.2.4-18.7.0,
latest 7.0 errata), I get:
fscanf result is -1, EOF value is -1

Comment 4 Need Real Name 2001-10-19 21:29:09 UTC
I performed the standard 7.0 installation.

rpm shows glibc 2.1.92

Comment 5 Need Real Name 2001-10-23 21:53:14 UTC
glibc-2.2.4-19 fixes the problem! Thanks.