bin/148201: sysinstall(8): core dump (Error 10) while trying to install packages via sysinstall

Garrett Cooper yanegomi at gmail.com
Tue Jul 13 14:40:06 UTC 2010


The following reply was made to PR bin/148201; it has been noted by GNATS.

From: Garrett Cooper <yanegomi at gmail.com>
To: bug-followup at FreeBSD.org, leon.gehling at 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


More information about the freebsd-sysinstall mailing list