From nobody@FreeBSD.org  Mon Jun 28 03:33:33 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F0E7106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jun 2010 03:33:33 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E93EA8FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jun 2010 03:33:32 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o5S3XWSN038825
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jun 2010 03:33:32 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o5S3XWjs038824;
	Mon, 28 Jun 2010 03:33:32 GMT
	(envelope-from nobody)
Message-Id: <201006280333.o5S3XWjs038824@www.freebsd.org>
Date: Mon, 28 Jun 2010 03:33:32 GMT
From: Leon Gehling <leon.gehling@googlemail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: core dump (Error 10) while trying to install packages via sysinstall
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         148201
>Category:       bin
>Synopsis:       sysinstall(8): core dump (Error 10) while trying to install packages via sysinstall
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-sysinstall
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 28 03:40:01 UTC 2010
>Closed-Date:    
>Last-Modified:  Tue Jul 13 14:40:04 UTC 2010
>Originator:     Leon Gehling
>Release:        Freebsd 8.1 RC1 AMD64
>Organization:
>Environment:
Freebsd 8.1 RC1 AMD64
>Description:
When i try to install a package from a ftp or http via the sysinstall, sysinstall crashes with the error: Error 10 core dump.


Hardware:

Mainboard: Gigabyte EP35-DS4
CPU:   Intel C2D E6850
RAM : 6 GB DDR2-800
HD: SATA-HD



PS: Sry for my broken english!


>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-standards->freebsd-sysinstall 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Tue Jul 13 13:41:27 UTC 2010 
Responsible-Changed-Why:  
Over to maintainer(s). 

To submitter: We will need more information from you before we can start to 
diagnose this. 

Firstly, could you please show the exact error message? 

If the error includes "(core dumped)", is there any chance you would be 
willing to do some further debugging?  You should find a file called 
"sysinstall.core" somewhere - can you run 
"gdb /usr/sbin/sysinstall sysinstall.core" 
and once inside gdb, give the "trace" command and show us the results? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148201 

From: Garrett Cooper <yanegomi@gmail.com>
To: bug-followup@FreeBSD.org, leon.gehling@googlemail.com
Cc:  
Subject: Re: bin/148201: sysinstall(8): core dump (Error 10) while trying to 
	install packages via sysinstall
Date: Tue, 13 Jul 2010 07:35:34 -0700

 Some other details, like install media settings and the package
 installed would be helpful.
 
 As far as the technical issues are concerned, it might be because fp
 isn't initialized to NULL in package_extract:
 
 int
 package_extract(Device *dev, char *name, Boolean depended)
 {
     char path[MAXPATHLEN];
     const char *PkgExts[] = { "", ".tbz", ".tbz2", ".tgz" };
     int last_msg, pathend, ret;
     size_t ext;
     FILE *fp;
 
 There's a codepath where if it fails to setup the `device' via
 DEVICE_GET, it'll be uninitialized with a bogus value:
 
     /* We have a path, call the device strategy routine to get the file */
     for (ext = 0 ; ext < sizeof PkgExts / sizeof PkgExts[0]; ++ext) {
         strlcpy(path + pathend, PkgExts[ext], sizeof path - pathend);
         if ((fp = DEVICE_GET(dev, path, TRUE)))
             break;
     }
 
     if (fp) {
 
 There are some other QA issues in this function as well...
 
 - fork can fail:
 
         pid = fork();
 
 - dup2 can fail:
 
             dup2(pfd[0], 0); close(pfd[0]);
             dup2(DebugFD, 1); dup2(1, 2);
             close(pfd[1]);
 
 - pipe can fail:
 
         pipe(pfd);
 
 - WEXITSTATUS is only valid if WIFEXITED is true:
 
             if (sigpipe_caught || i < 0 || WEXITSTATUS(tot)) {
 
 - signal can fail:
 
         signal(SIGPIPE, catch_pipe);
 
 - This can spin the CPU (doesn't matter so much on install media, but
 it does matter for multiuser):
 
             /* Now catch any stragglers */
             while (wait3(&tot, WNOHANG, NULL) > 0);
 
 Thanks,
 -Garrett
>Unformatted:
