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

2016-04-20 Thread konsolebox
On Tue, Apr 19, 2016 at 10:45 PM, 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. Choose: Should the shell stop execution or not? Can you give a theor

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

2016-04-20 Thread Chet Ramey
On 4/19/16 11:03 AM, Piotr Grzybowski wrote: > > - if it expands to a legal identifier create the coproc > > This isn't necessary; there's no reason to restrict a coproc name to > something stricter than the set of valid executable names. I suppose > I could see restricting it to

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

2016-04-20 Thread David Maas
So if you really want my opinion, the shell should be aware that it's in a function. You could possibly implement this by keeping track of the parent pid. Another solution would be to not check the syntax of the function until the function is actually run. I wouldn't do strict posix soley because t

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

2016-04-20 Thread David Maas
Incidentally, is it possible that somehow )) is simply interpreted the same as } in this situation? It would also explain the perceived behavior. On Wed, Apr 20, 2016 at 12:55 AM, konsolebox wrote: > On Tue, Apr 19, 2016 at 10:45 PM, David Maas wrote: > > Running the echo and other contents of

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

2016-04-20 Thread Greg Wooledge
On Wed, Apr 20, 2016 at 08:30:48AM -0700, David Maas wrote: > So if you really want my opinion, the shell should be aware that it's in a > function. Agreed, unless it's really hard to do. > You could possibly implement this by keeping track of the parent > pid. Nonsense. Function calls do not c

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

2016-04-20 Thread David Maas
Fair enough. On Wed, Apr 20, 2016 at 8:44 AM, Greg Wooledge wrote: > On Wed, Apr 20, 2016 at 08:30:48AM -0700, David Maas wrote: > > So if you really want my opinion, the shell should be aware that it's in > a > > function. > > Agreed, unless it's really hard to do. > > > You could possibly impl

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

2016-04-20 Thread Chet Ramey
On 4/20/16 8:33 AM, David Maas wrote: > Incidentally, is it possible that somehow )) is simply interpreted the same > as } in this situation? It would also explain the perceived behavior. No. The parser resynchronizes at newline when performing error recovery. -- ``The lyf so short, the craft s