From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 27 21:29:39 2011 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34249106566C; Sun, 27 Feb 2011 21:29:39 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [IPv6:2001:470:1f0b:105e::1ea]) by mx1.freebsd.org (Postfix) with ESMTP id EB5128FC14; Sun, 27 Feb 2011 21:29:38 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id 8A691E687; Sun, 27 Feb 2011 22:29:37 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Stefan Bethke In-Reply-To: Date: Sun, 27 Feb 2011 22:29:36 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <0A08CDDB-5482-4805-91F9-0DDD37AE7A7A@lassitu.de> References: <201102241311.p1ODBajF050380@freefall.freebsd.org> <83C33215-1358-4606-A7A8-FC40BCC08E69@lassitu.de> To: Eitan Adler X-Mailer: Apple Mail (2.1082) Cc: freebsd-bugs@freebsd.org Subject: Re: gnu/137665: [patch] dialog(1) goes into tight loop on encountering eof X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Feb 2011 21:29:39 -0000 Am 27.02.2011 um 21:55 schrieb Eitan Adler: >> dialog does not go into a tight loop eating all CPU, but it still = gets stuck. I believe it should take some action on encountering EOF, = instead of waiting for input forever. My patch did that for the old = dialog, typically taking the same path as pressing ESC would. >=20 > I can not reproduce this using the command stated in the PR: >=20 > $dialog --yesno foo -1 -1 =20 > $dialog --version > Version: 1.1-20100428 You are correct, I did assume that dialog was hung when in fact it is = waiting for input. The man page does not mention any behavior relative = to stdin being redirected, and I expected dialog to honor a redirection. = Evidently, it manages to take input from the tty instead of from stdin. = Is this the expected behavior? # printf "\n" | dialog --yesno foo -1 -1=20 This will wait for input from the tty, instead of returning immediately. The reason I'm unhappy with the behavior of the old dialog, and the = current behavior, is that if a script unintentionally invokes dialog = (for example when running portupgrade from a script, and the port or = package using dialog), the script stalls. If you run the script from a = cron job, it will never terminate. I'd prefer a deterministic, = terminating reaction to stdin not being a tty. While dialog is meant to provide a user interface, there are situations = where you want to be able to script someone elses use of (some embedded) = dialog, and I'd rather have a chance to at least continue instead of = being stuck at that point, or even having to break out expect again. Stefan --=20 Stefan Bethke Fon +49 151 14070811