From avn@ns.any.ru  Sat Sep 22 09:09:57 2001
Return-Path: <avn@ns.any.ru>
Received: from ns.any.ru (ns.any.ru [194.67.127.11])
	by hub.freebsd.org (Postfix) with ESMTP id 9191937B406
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 22 Sep 2001 09:09:56 -0700 (PDT)
Received: (from avn@localhost)
	by ns.any.ru (8.11.3/8.11.3) id f8MH6rN22399
	for FreeBSD-gnats-submit@freebsd.org.AVP; Sat, 22 Sep 2001 20:06:53 +0300 (EEST)
	(envelope-from avn)
Received: (from avn@localhost)
	by ns.any.ru (8.11.3/8.11.3) id f8MH6pD22390;
	Sat, 22 Sep 2001 20:06:51 +0300 (EEST)
	(envelope-from avn)
Message-Id: <200109221706.f8MH6pD22390@ns.any.ru>
Date: Sat, 22 Sep 2001 20:06:51 +0300 (EEST)
From: alex.neyman@auriga.ru
Reply-To: alex.neyman@auriga.ru
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sysinstall leaks file descriptors on restart
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         30737
>Category:       bin
>Synopsis:       sysinstall(8): sysinstall leaks file descriptors on restart
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-sysinstall
>State:          analyzed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 22 09:10:01 PDT 2001
>Closed-Date:    
>Last-Modified:  Sun Jan 23 20:59:37 UTC 2011
>Originator:     Alexey V. Neyman
>Release:        FreeBSD 4.4-RELEASE
>Organization:
Auriga, Inc.
>Environment:
n/a
>Description:
In a signal handler for ^C, the user is given a possibility to restart
the installation utility. However, restart procedure does not close already
open file descriptors, thus, new sysinstall starts with fewer fds.
>How-To-Repeat:
Run the installation; hit ^C, choose Restart and look at VTY2. You'll see
that the fd number for ioctl(TIOCCONS) is rising each time you hit
^C -> Restart.
>Fix:
(the patch is untested)
--- system.c.orig	Sat Sep 22 19:49:49 2001
+++ system.c	Sat Sep 22 19:52:33 2001
@@ -56,6 +56,11 @@
 static int
 intr_restart(dialogMenuItem *self)
 {
+	int fd, fdmax;
+
+	fdmax = getdtablesize();
+	for (fd = 3; fd < fdmax; fd++)
+		close(fd);
 	execl(StartName, StartName, (char *)NULL);
 	/* NOTREACHED */
 	return -1;
>Release-Note:
>Audit-Trail:

From: alex.neyman@auriga.ru
To: FreeBSD-gnats-submit@freebsd.org
Cc:  
Subject: bin/30737: sysinstall leaks file descriptors on restart
Date: Sat, 22 Sep 2001 20:06:51 +0300 (EEST)

 >Number:         30737
 >Category:       bin
 >Synopsis:       sysinstall leaks file descriptors on restart
 >Confidential:   no
 >Severity:       non-critical
 >Priority:       medium
 >Responsible:    freebsd-bugs
 >State:          open
 >Quarter:        
 >Keywords:       
 >Date-Required:
 >Class:          sw-bug
 >Submitter-Id:   current-users
 >Arrival-Date:   Sat Sep 22 09:10:01 PDT 2001
 >Closed-Date:
 >Last-Modified:
 >Originator:     Alexey V. Neyman
 >Release:        FreeBSD 4.4-RELEASE
 >Organization:
 Auriga, Inc.
 >Environment:
 n/a
 >Description:
 In a signal handler for ^C, the user is given a possibility to restart
 the installation utility. However, restart procedure does not close already
 open file descriptors, thus, new sysinstall starts with fewer fds.
 >How-To-Repeat:
 Run the installation; hit ^C, choose Restart and look at VTY2. You'll see
 that the fd number for ioctl(TIOCCONS) is rising each time you hit
 ^C -> Restart.
 >Fix:
 (the patch is untested)
 --- system.c.orig	Sat Sep 22 19:49:49 2001
 +++ system.c	Sat Sep 22 19:52:33 2001
 @@ -56,6 +56,11 @@
  static int
  intr_restart(dialogMenuItem *self)
  {
 +	int fd, fdmax;
 +
 +	fdmax = getdtablesize();
 +	for (fd = 3; fd < fdmax; fd++)
 +		close(fd);
  	execl(StartName, StartName, (char *)NULL);
  	/* NOTREACHED */
  	return -1;
 >Release-Note:
 >Audit-Trail:
 >Unformatted:
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
Responsible-Changed-From-To: freebsd-bugs->murray 
Responsible-Changed-By: murray 
Responsible-Changed-When: Sun Sep 23 20:20:42 PDT 2001 
Responsible-Changed-Why:  
I was just looking at this code, so I'll take this one. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30737 
State-Changed-From-To: open->analyzed 
State-Changed-By: murray 
State-Changed-When: Sat Sep 29 17:43:56 PDT 2001 
State-Changed-Why:  
Your change has been committed to -CURRENT, thanks!  There are still 
problems with the restart code.  One problem is that dhclient starts 
but is never killed, so if you restart sysinstall it will try to call 
dhclient again and this will fail.  The routing table also causes 
problems.  For some reasone /var/run/dhclient.pid is not being created 
by dhclient either.  dhclient should be shutdown in the mediaClose 
function for the network device. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30737 
Responsible-Changed-From-To: murray->freebsd-qa 
Responsible-Changed-By: murray 
Responsible-Changed-When: Fri Mar 18 15:30:43 GMT 2005 
Responsible-Changed-Why:  
There is still a valid sysinstall/dhcp interaction issue here, but I'm 
not actively working on it. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=30737 
Responsible-Changed-From-To: freebsd-bugs->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sun Apr 25 11:40:27 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30737 
Responsible-Changed-From-To: brucec->freebsd-sysinstall 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sun Jan 23 20:59:19 UTC 2011 
Responsible-Changed-Why:  
Back to the pool. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=30737 
>Unformatted:
