10.0-ALPHA1: /usr/bin/read: strange return code with -t option
Jilles Tjoelker
jilles at stack.nl
Tue Oct 22 19:24:48 UTC 2013
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
More information about the freebsd-stable
mailing list