From jin@iss-p1.lbl.gov  Mon Jun  9 20:56:36 1997
Received: from iss-p1.lbl.gov (iss-p1.lbl.gov [131.243.2.47])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id UAA06263
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 9 Jun 1997 20:56:36 -0700 (PDT)
Received: (from jin@localhost)
	by iss-p1.lbl.gov (8.8.5/8.8.5) id UAA20118;
	Mon, 9 Jun 1997 20:56:35 -0700 (PDT)
Message-Id: <199706100356.UAA20118@iss-p1.lbl.gov>
Date: Mon, 9 Jun 1997 20:56:35 -0700 (PDT)
From: "Jin Guojun[ITG]" <jin@iss-p1.lbl.gov>
Reply-To: jin@iss-p1.lbl.gov
To: FreeBSD-gnats-submit@freebsd.org
Subject: fopen/freopen fails on some binary files.
X-Send-Pr-Version: 3.2

>Number:         3827
>Category:       kern
>Synopsis:       fopen/freopen fails on some binary files.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun  9 21:00:00 PDT 1997
>Closed-Date:    Tue Jun 2 18:00:09 PDT 1998
>Last-Modified:  Tue Jun  2 18:01:23 PDT 1998
>Originator:     Jin Guojun[ITG]
>Release:        FreeBSD 3.0-970527-SNAP i386
>Organization:
>Environment:

	FreeBSD 3.0-970527-SNAP

>Description:

	freopen() fails on about 50% binary files. It causes application
	handing. The programs are used for reading images and processing
	for enhancement. The first part reads the header (Text).
	When read/fread hang, the top show that it uses all available CPU.
	If SMP is enabled, this hanging process will take about at least
	one minute to be killed. In non-SMP kernel, it can be killed
	immediately.
	In gdb, after freopen(), do "p ftell(fp)" will get bad memory error.
	open() has the same problem.
	The same application using "<" works OK. 

>How-To-Repeat:

	No regular pattern for such failure. Normally, for same reading code,
	keep adding more code after it (such as more subroutines), the reading
	code will hang at reading same binary file.

>Fix:
	
	

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: phk 
State-Changed-When: Sat Apr 11 14:35:31 PDT 1998 
State-Changed-Why:  
We will need more info on this one, can you construct a small 
example incl data file which provokes this ? 
Why do you freopen the file in the first place ? 
State-Changed-From-To: feedback->closed 
State-Changed-By: steve 
State-Changed-When: Tue Jun 2 18:00:09 PDT 1998 
State-Changed-Why:  
Originator says this was fixed in the 3.0-980520-SNAP. 
>Unformatted:
