David Boyd
2013-Oct-22 18:25 UTC
10.0-ALPHA1: /usr/bin/read: strange return code with -t option
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 Thanks for your assistance with this issue. David Boyd David.Boyd49 at twc.com
Jilles Tjoelker
2013-Oct-22 19:24 UTC
10.0-ALPHA1: /usr/bin/read: strange return code with -t option
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 $? > 142I 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