NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: install/56326: sysinst expands NetBSD kernel with some garbagesymbols at the end of filename



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

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>, vezhlys%gmail.com@localhost,
        Andreas Gustafsson <gson%gson.org@localhost>, martin%netbsd.org@localhost
Subject: Re: install/56326: sysinst expands NetBSD kernel with some garbagesymbols
  at the end of filename
Date: Thu, 29 Jul 2021 07:54:27 +0000 (UTC)

 On Mon, 26 Jul 2021, Izumi Tsutsui wrote:
 
 > > I have not tried to reproduce it, but I'll try how it goes
 > > to upgrade 9.2 to 9.2 again.
 >
 > Not 100% reproducible, but happens again on 9.2 to 9.2 upgrade:
 > ---
 > -rwxr-xr-x   1 root  wheel  20688364 May 12 13:15 netbsd
 > -rwxr-xr-x   1 root  wheel  13237760 Jul 26 13:52 netbsd17eUKh
 > ---
 >
 
 Can you enable logging (& scripting) in the "Utilities" menu and
 try again? Then post /tmp/sysinst.{log,sh} if you see any temp.
 filenames.
 
 I've modified sysinst/run.c:launch_subwin() slightly so now it
 doesn't do so much unnecessary work. Please test this out too.
 
 -RVP
 
 ---START---
 diff -urN sysinst.orig/run.c sysinst/run.c
 --- sysinst.orig/run.c	2019-11-16 20:26:59.000000000 +0000
 +++ sysinst/run.c	2021-07-28 22:54:09.014876627 +0000
 @@ -49,6 +49,7 @@
   #include <signal.h>
   #include <err.h>
   #include <sys/ioctl.h>
 +#include <sys/param.h>
   #include <sys/types.h>
   #include <sys/wait.h>
   #include <sys/stat.h>
 @@ -381,10 +382,10 @@
   launch_subwin(WINDOW **actionwin, char **args, struct winsize *win, int flags,
       const char *scmd, const char **errstr)
   {
 -	int n, i;
 +	int n, i, maxfd;
   	int selectfailed;
   	int status, master, slave;
 -	fd_set active_fd_set, read_fd_set;
 +	fd_set read_fd_set;
   	pid_t child, pid;
   	char ibuf[MAXBUF];
   	char pktdata;
 @@ -488,10 +489,6 @@
   	 * input to the program.
   	 */
 
 -	FD_ZERO(&active_fd_set);
 -	FD_SET(master, &active_fd_set);
 -	FD_SET(STDIN_FILENO, &active_fd_set);
 -
   	for (selectfailed = 0;;) {
   		if (selectfailed) {
   			const char mmsg[] =
 @@ -500,13 +497,17 @@
   				(void)fprintf(logfp, mmsg);
   			errx(1, mmsg);
   		}
 -		read_fd_set = active_fd_set;
 +		FD_ZERO(&read_fd_set);
 +		FD_SET(master, &read_fd_set);
 +		FD_SET(STDIN_FILENO, &read_fd_set);
 +		maxfd = MAX(master, STDIN_FILENO) + 1;
   		tmo.tv_sec = flags & RUN_SILENT ? 20 : 2;
   		tmo.tv_usec = 0;
 -		i = select(FD_SETSIZE, &read_fd_set, NULL, NULL, &tmo);
 -		if (i == 0 && *actionwin == NULL && (flags & RUN_SILENT) == 0)
 -			*actionwin = show_cmd(scmd, win);
 -		if (i < 0) {
 +		i = select(maxfd, &read_fd_set, NULL, NULL, &tmo);
 +		if (i == 0) {
 +			if (*actionwin == NULL && (flags & RUN_SILENT) == 0)
 +				*actionwin = show_cmd(scmd, win);
 +		} else if (i < 0) {
   			if (errno != EINTR) {
   				warn("select");
   				if (logfp)
 @@ -515,7 +516,7 @@
   					    strerror(errno));
   				selectfailed = 1;
   			}
 -		} else for (i = 0; i < FD_SETSIZE; ++i) {
 +		} else for (i = 0; i < maxfd; ++i) {
   			if (!FD_ISSET(i, &read_fd_set))
   				continue;
   			n = read(i, ibuf, sizeof ibuf - 1);
 ---END---
 
 


Home | Main Index | Thread Index | Old Index