From owner-freebsd-stable@FreeBSD.ORG Sat Oct 15 07:25:25 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1205D106564A; Sat, 15 Oct 2011 07:25:25 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 625FB8FC0A; Sat, 15 Oct 2011 07:25:23 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so751413bkb.13 for ; Sat, 15 Oct 2011 00:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=C07xK7IO21seAxtZ0opZvlYElvW+dj6pK2a/aS6fT7U=; b=rbJZ9/CUJXNzp+/EC5lJUbUTc1LZuwFZ6yjhNqxTSmAzVRNGELozIPXzVE9vGoichX 7TYZgtT+HuZE/0TLu8WDWCRdgDKpx/9IcZpYq0FZ1BmmfvjwuhJ5opXSvNLRfezvixL3 yA52pEaLnWUNgFEuwv94k4yAmtMBLV1vExzlc= Received: by 10.223.76.135 with SMTP id c7mr7969999fak.16.1318663523095; Sat, 15 Oct 2011 00:25:23 -0700 (PDT) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id v17sm8597486fai.18.2011.10.15.00.25.19 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 15 Oct 2011 00:25:20 -0700 (PDT) From: Mikolaj Golub To: Adrian Wontroba References: <20110918045413.GA63773@DataIX.net> <20110918053901.GA31617@icarus.home.lan> <86d3eydsmf.fsf@kopusha.home.net> <20111008002707.GA76128@swelter.hanley.stade.co.uk> <20111012222535.GB79291@swelter.hanley.stade.co.uk> X-Comment-To: Adrian Wontroba Sender: Mikolaj Golub Date: Sat, 15 Oct 2011 10:25:16 +0300 In-Reply-To: <20111012222535.GB79291@swelter.hanley.stade.co.uk> (Adrian Wontroba's message of "Wed, 12 Oct 2011 23:25:35 +0100") Message-ID: <86zkh2k97n.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: Kostik Belousov , "freebsd-stable@freebsd.org" , Jilles Tjoelker Subject: Re: /usr/bin/script eating 100% cpu with portupgrade and xargs X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2011 07:25:25 -0000 --=-=-= 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; } --=-=-=--