From owner-freebsd-stable@FreeBSD.ORG Sun Sep 18 17:24:30 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 04C41106564A; Sun, 18 Sep 2011 17:24:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 2F55E8FC0C; Sun, 18 Sep 2011 17:24:28 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8IHOOZA008110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Sep 2011 20:24:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id p8IHOOqR095313; Sun, 18 Sep 2011 20:24:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id p8IHONqr095312; Sun, 18 Sep 2011 20:24:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 18 Sep 2011 20:24:23 +0300 From: Kostik Belousov To: Mikolaj Golub Message-ID: <20110918172423.GB1511@deviant.kiev.zoral.com.ua> References: <20110918045413.GA63773@DataIX.net> <20110918053901.GA31617@icarus.home.lan> <86d3eydsmf.fsf@kopusha.home.net> <868vpmdq11.fsf@kopusha.home.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v4PrGfol6wGsg/Ra" Content-Disposition: inline In-Reply-To: <868vpmdq11.fsf@kopusha.home.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: "freebsd-stable@freebsd.org" , cperciva@freebsd.org, Jeremy Chadwick , Ronald Klop 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: Sun, 18 Sep 2011 17:24:30 -0000 --v4PrGfol6wGsg/Ra Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 18, 2011 at 02:54:34PM +0300, Mikolaj Golub wrote: >=20 > On Sun, 18 Sep 2011 13:25:26 +0200 Ronald Klop wrote: >=20 > RK> It is a while since I programmed C, but why will writing 0 bytes give > RK> the reader an end-of-file? Shouldn't the fd be closed to indicate > RK> end-of-file? >=20 > AFAIR, this trick with writing 0 to emulate EOF because we can't close th= e fd > -- we still want to read from it. Poor shutdown(2) for non-socket :-). >=20 > Colin might tell more... Please note that interpreting the receiving of 0 bytes on the terminal=20 as EOF is only a convention. If done absolutely properly, script shall not interpret zero-byte read as EOF. Might be, the reasonable thing to do would be to only look at the stdin once in a second after receiving zero-bytes, and switching it back to normal mode if something is read. --v4PrGfol6wGsg/Ra Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk52KUYACgkQC3+MBN1Mb4gI1wCcDM9mGLAyKEoecxKLXvLiqDTC xrgAoM28QBmnM88nSDvXOKPjkCRh78j0 =e/jT -----END PGP SIGNATURE----- --v4PrGfol6wGsg/Ra--