From jin@adv-pc-1.lbl.gov  Fri Feb 21 15:02:17 1997
Received: from adv-pc-1.lbl.gov (adv-pc-1.lbl.gov [128.3.196.189])
          by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA01018
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 Feb 1997 15:02:16 -0800 (PST)
Received: (from jin@localhost)
	by adv-pc-1.lbl.gov (8.8.5/8.8.5) id PAA01597;
	Fri, 21 Feb 1997 15:02:11 -0800 (PST)
Message-Id: <199702212302.PAA01597@adv-pc-1.lbl.gov>
Date: Fri, 21 Feb 1997 15:02:11 -0800 (PST)
From: "Jin Guojun[ITG]" <jin@adv-pc-1.lbl.gov>
Reply-To: jin@adv-pc-1.lbl.gov
To: FreeBSD-gnats-submit@freebsd.org
Subject: libc_r make fscanf failure
X-Send-Pr-Version: 3.2

>Number:         2793
>Category:       misc
>Synopsis:       libc_r make fscanf failure
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 21 15:10:01 PST 1997
>Closed-Date:    Wed Sep 16 23:34:00 MEST 1998
>Last-Modified:  Wed Sep 16 23:34:27 MEST 1998
>Originator:     Jin Guojun[ITG]
>Release:        FreeBSD 2.2-970215-GAMMA i386
>Organization:
>Environment:

	libc_r, as well as the MIT pthreads, under 2.2 and 3.0

>Description:

	Some one here write such code that found fscanf failed under pthreads:
	both c_r library and MIT pthreads cause the same problem.
	Here is the 4-line code --
---------------- foo.c -------------------------------
#include <pthread.h>	/* does not make any difference	*/
#include <stdio.h>  
main()
{
char ans[16];

	fprintf(stderr,"enter Y or N\n");
	fscanf( stdin, "%s", ans);
	fprintf(stderr,"You entered :%s:\n", ans);

printf("EOF = %d\n", feof(stdin));
}
------------------------------------------------------

>How-To-Repeat:

	compile above program by followings

		cc foo.c -o foo		# works
		cc foo.c -o foo -lc_r	# fails
		cc foo.c -o foo -lpthreads # MIT, fails too

	Since it failed under both  -lc_r and -lpthreads, I would guess
	the problem is in kernel some where. When linked to pthread libraries,
	gdb will not able to trace the code. By ktrace and kdump, it seems
	started tons of SIG processes, which may be the place where problem 
	occurs.
>Fix:
	
	not knowing where is the bug.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: gpalmer 
Responsible-Changed-When: Sat Feb 22 18:25:33 PST 1997 
Responsible-Changed-Why:  
Misfiled PR 
State-Changed-From-To: open->closed 
State-Changed-By: cracauer 
State-Changed-When: Wed Sep 16 23:34:00 MEST 1998 
State-Changed-Why:  
Problem no longer present in recent FreeBSD versions 
>Unformatted:
