Bug in syntax checking causes unintended running of a function

2016-04-19 Thread David Maas
Running the echo and other contents of the function really doesn't seem like the correct behavior. If the function isn't called, then its contents shouldn't be executed. Hypothetically, what if the author was partway through writing a backup script that removes backed up data? The behavior of bash

Re: Bug in syntax checking causes unintended running of a function

2016-04-19 Thread Greg Wooledge
On Tue, Apr 19, 2016 at 07:45:27AM -0700, David Maas wrote: > Running the echo and other contents of the function really doesn't seem > like the correct behavior. If the function isn't called, then its contents > shouldn't be executed. I believe the theory is the syntax error is confusing the pars

Re: Bug in syntax checking causes unintended running of a function

2016-04-19 Thread Chet Ramey
On 4/18/16 12:52 PM, David Maas wrote: > Hi! I found a bug in bash, I've checked versions 4.1 (centos 6.7), 4.2 > (centos 7.2), and 4.3.30 (from the ftp site). The bug is that if you do a > double parenthesis math thing with the wrong syntax, the script runs the > function during what I assume is s

Re: Bug in syntax checking causes unintended running of a function

2016-04-19 Thread Chet Ramey
On 4/19/16 7:45 AM, David Maas wrote: > Running the echo and other contents of the function really doesn't seem > like the correct behavior. If the function isn't called, then its contents > shouldn't be executed. There are no `function contents'. There is no function. There was a syntax error

Re: Bug in syntax checking causes unintended running of a function

2016-04-19 Thread Chet Ramey
On 4/19/16 7:52 AM, Greg Wooledge wrote: > On Tue, Apr 19, 2016 at 07:45:27AM -0700, David Maas wrote: >> Running the echo and other contents of the function really doesn't seem >> like the correct behavior. If the function isn't called, then its contents >> shouldn't be executed. > > I believe th

Re: cd's Extraneous Arguments.

2016-04-19 Thread Chet Ramey
On 4/16/16 4:24 AM, Ralph Corderoy wrote: > Hi Chet, > >>> `cd foo bar xyzzy' changes directory to foo, complaining if it >>> doesn't exist. It doesn't complain about the unwanted extra >>> arguments. This can cause problems; `cd *04' ends up in 2015-04, >>> not 2016-04. >> >> If you want this

Re: [patch] /* XXX - possibly run Coproc->name through word expansion? */

2016-04-19 Thread Chet Ramey
On 4/16/16 8:13 AM, Piotr Grzybowski wrote: > Hi, > > for some time I wanted to do: > > WORKERS_COUNT=8; > for((i=0;i<${WORKERS_COUNT};i++)); do > coproc worker$i { worker_code; }; > done; > > and since lately I got an actual real, production, case where I had to run > given number of workers

Re: [patch] /* XXX - possibly run Coproc->name through word expansion? */

2016-04-19 Thread Piotr Grzybowski
On Tue, Apr 19, 2016 at 7:02 PM, Chet Ramey wrote: > On 4/16/16 8:13 AM, Piotr Grzybowski wrote: > > > ​ [..]​ > > > - expand the name given to coproc > > I'll consider this for a future version of bash. > ​ > ​thanks. maybe someone else finds it useful? ​ > > > - if it expands to a legal iden