Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Oct 2011 10:25:16 +0300
From:      Mikolaj Golub <trociny@freebsd.org>
To:        Adrian Wontroba <aw1@stade.co.uk>
Cc:        Kostik Belousov <kib@FreeBSD.org>, "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>, Jilles Tjoelker <jilles@stack.nl>
Subject:   Re: /usr/bin/script eating 100% cpu with portupgrade and xargs
Message-ID:  <86zkh2k97n.fsf@kopusha.home.net>
In-Reply-To: <20111012222535.GB79291@swelter.hanley.stade.co.uk> (Adrian Wontroba's message of "Wed, 12 Oct 2011 23:25:35 %2B0100")
References:  <op.v1y8gdtf8527sy@pinky> <20110918045413.GA63773@DataIX.net> <20110918053901.GA31617@icarus.home.lan> <op.v1zrszht8527sy@pinky> <86d3eydsmf.fsf@kopusha.home.net> <CAOnPXZ9z2MoZ7uxyUQzBx3Lz1mhY-2JKxO0mepzMp81J4WEVtw@mail.gmail.com> <20111008002707.GA76128@swelter.hanley.stade.co.uk> <20111012222535.GB79291@swelter.hanley.stade.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=


On Wed, 12 Oct 2011 23:25:35 +0100 Adrian Wontroba wrote:

 AW> On Sat, Oct 08, 2011 at 01:27:07AM +0100, Adrian Wontroba wrote:
 >> I won't be in a position to create a simpler test case, raise a PR or
 >> try patches till Tuesday evening (UK) at the earliest.

 AW> So far I have been unable to reproduce the problem with portupgrade (and
 AW> will probably move to portmaster).

 AW> I have however found a different but possibly related problem with the
 AW> new version of script in RELENG_8, for which I have raised this PR:

 AW> misc/161526: script outputs corrupt if input is not from a terminal

As Jilles wrote ^D\b\b are echoed by the terminal when the script sends VEOF
to the program being script. 

In my recent commit r225809 the intention was to sent VEOF only once if STDIN
was not terminal. Unfortunately the fix was incorrect and for flushtime > 0 it
keeps sending VEOF. That is why you are observing series of ^D\b\b characters.

I am going to commit the attached patch to HEAD, that fixes this. But we will
still have one ^D\b\b in the output.

-- 
Mikolaj Golub

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=script.c.4.patch

Index: usr.bin/script/script.c
===================================================================
--- usr.bin/script/script.c	(revision 226349)
+++ usr.bin/script/script.c	(working copy)
@@ -163,12 +163,15 @@ main(int argc, char *argv[])
 		FD_SET(master, &rfd);
 		if (readstdin)
 			FD_SET(STDIN_FILENO, &rfd);
-		if ((!readstdin && ttyflg) || flushtime > 0) {
-			tv.tv_sec = !readstdin && ttyflg ? 1 :
-			    flushtime - (tvec - start);
+		if (!readstdin && ttyflg) {
+			tv.tv_sec = 1;
 			tv.tv_usec = 0;
 			tvp = &tv;
 			readstdin = 1;
+		} else if (flushtime > 0) {
+			tv.tv_sec = flushtime - (tvec - start);
+			tv.tv_usec = 0;
+			tvp = &tv;
 		} else {
 			tvp = NULL;
 		}

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86zkh2k97n.fsf>