Re: [minor] for/select parsing inconsistency

2018-12-09 Thread Chet Ramey
On 12/7/18 8:02 AM, Martijn Dekker wrote:
> There is a minor inconsistency in grammatical parsing between 'for' and
> 'select' loops. Since 'select' is basically a glorified 'for', it seems to
> me that they should parse the same way.
> 
> $ bash -c 'for x in; do :; done'
> $ bash -c 'select x in; do :; done'
> bash: -c: line 0: syntax error near unexpected token `;'
> bash: -c: line 0: `select x in; do :; done'
> $ bash -c 'foo=; select x in $foo; do :; done'

Thanks for the report. I'll take a look and fix it for bash-5.0-rc1.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: write() not retried after EINTR in printf and echo

2018-12-09 Thread Pusillanimous Pussyfooter
> There are a couple of signals for which this is the appropriate behavior.
> The right fix is to install handlers with the SA_RESTART flag set. The
> next version of bash will install its SIGWINCH handler with SA_RESTART.

Here is a trivial patch doing just that, though IMHO it would be much better
and more consistent to check for EINTR and restart the write() system call,
as it's already done for open() in redir.c:redir_open(). The EINTR "error"
should never be user visible, no matter what signal had caused it.

The problem could also be reproduced with

printf '%065535d' 1 | sleep 1

followed by a terminal resize, but not with

mkfifo /tmp/fifo; exec 7