Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2013 21:24:45 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        David Boyd <David.Boyd49@twc.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: 10.0-ALPHA1: /usr/bin/read: strange return code with -t option
Message-ID:  <20131022192445.GA20055@stack.nl>
In-Reply-To: <9C08537CB81F4AF79E330DB6E8AA2890@sneezy>
References:  <9C08537CB81F4AF79E330DB6E8AA2890@sneezy>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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