From owner-freebsd-stable@FreeBSD.ORG Tue Oct 22 19:24:48 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E27612A5 for ; Tue, 22 Oct 2013 19:24:48 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A0610217F for ; Tue, 22 Oct 2013 19:24:48 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id CF11C359314; Tue, 22 Oct 2013 21:24:45 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id B4E53CB4E; Tue, 22 Oct 2013 21:24:45 +0200 (CEST) Date: Tue, 22 Oct 2013 21:24:45 +0200 From: Jilles Tjoelker To: David Boyd Subject: Re: 10.0-ALPHA1: /usr/bin/read: strange return code with -t option Message-ID: <20131022192445.GA20055@stack.nl> References: <9C08537CB81F4AF79E330DB6E8AA2890@sneezy> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9C08537CB81F4AF79E330DB6E8AA2890@sneezy> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 19:24:48 -0000 On Tue, Oct 22, 2013 at 02:25:15PM -0400, David Boyd wrote: > When using /usr/bin/read with the -t option the "timeout" return code should > be 1 (verified with 8.4-RELEASE and 9.2-RELEASE). When used with > 10.0-BETA1, the return code is 142. > How to recreate: > /usr/bin/read -t 1 RESPONSE JUNK (allow this to timeout) > echo $? > 142 > Also with /bin/sh: > builtin read -t 1 RESPONSE JUNK (allow this to timeout) > echo $? > 142 I changed this to allow distinguishing a timeout from end of file. I also changed the exit status for read errors and read interrupted by a trap, so exit status 1 now means end of file only. Since read used to return 0 and 1 only (except when invalid arguments are given), I considered this fairly safe. This change is also in the spirit of http://austingroupbugs.net/view.php?id=367 and similar to what bash does. -- Jilles Tjoelker