Re: Latest push for command substitutions

2021-06-24 Thread Chet Ramey

On 6/24/21 5:44 AM, Koichi Murase wrote:

Maybe this is not caused by the change of this time, but another
related problem. When the nested command substitutions are incomplete,
an error message of the (false) syntax error is printed before PS2.
The command is still executed correctly after closing the command
substitutions.


This doesn't have anything to do with the parser, per se, or this change.
It's an interactive-only error similar to

https://lists.gnu.org/archive/html/bug-bash/2021-02/msg00037.html

caused by the history code trying to determine which delimiter to use when
adding this line to the history list.

--
``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: Latest push for command substitutions

2021-06-24 Thread Chet Ramey

On 6/24/21 5:18 AM, Koichi Murase wrote:

Please run it through any tests or scripts you have so we can shake out any
bugs early.


I haven't thoroughly tested it, but I found with a quick trial that
the parser state seems to remain broken in the new command line after
a syntax error:


Thanks for the report. This is a new class of error, I suppose is the best
way to put it, introduced with this new implementation. In the previous ad-
hoc implementation, the "parse" would succeed until word expansion, then
fail when the string was run through the parser again to find the closing
`)'.

There's already code in there to handle this case, it just needs different
return values to handle the error differently. There are a couple of ways
to deal with this interactive-only error, so I'll pick one.

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: Latest push for command substitutions

2021-06-24 Thread Koichi Murase
Maybe this is not caused by the change of this time, but another
related problem. When the nested command substitutions are incomplete,
an error message of the (false) syntax error is printed before PS2.
The command is still executed correctly after closing the command
substitutions.

$ LANG=C ./bash --norc
$ echo $(echo $(echo A
bash: command substitution: line 3: unexpected EOF while looking for
matching `)'
> )
> echo B
> )
A B
$

A non-nested command substitution works as expected.

$ echo $(echo A
> )
A
$

Actually, Bash 5.1 seems to have behaved in an even stranger way. It
shows a new PS1 after the error message, but we can still continue to
input the remaining part of the previous command and run it correctly:

$ LANG=C bash-5.1 --norc
$ echo $(echo $(echo A
bash-5.1: unexpected EOF while looking for matching `)'
$ )
> echo B
> )
A B
$

The behavior of Bash 5.0 is the expected one:

$ LANG=C bash-5.0 --norc
$ echo $(echo $(echo A
> )
> echo B
> )
A B

--
Koichi

2021年6月23日(水) 5:41 Chet Ramey :
>
> The latest devel branch push has a rewrite of parse_comsub() to recursively
> call the parser (yyparse()). I was finally able to get all the state
> working correctly, though it will probably only work with bison.
>
> Please run it through any tests or scripts you have so we can shake out any
> bugs early.
>
> 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: Latest push for command substitutions

2021-06-24 Thread Alex fxmbsw7 Ratchev
lol what the weird behavior

On Thu, Jun 24, 2021, 11:19 Koichi Murase  wrote:

> > Please run it through any tests or scripts you have so we can shake out
> any
> > bugs early.
>
> I haven't thoroughly tested it, but I found with a quick trial that
> the parser state seems to remain broken in the new command line after
> a syntax error:
>
> $ ./bash --norc
> $ printf '[%s]\n' $(if)
> bash: syntax error near unexpected token `)'
> $ echo abcdef
> [echo]
> bash: abcdef: command not found
> $
>
> --
> Koichi
>
>


Re: Latest push for command substitutions

2021-06-24 Thread Koichi Murase
> Please run it through any tests or scripts you have so we can shake out any
> bugs early.

I haven't thoroughly tested it, but I found with a quick trial that
the parser state seems to remain broken in the new command line after
a syntax error:

$ ./bash --norc
$ printf '[%s]\n' $(if)
bash: syntax error near unexpected token `)'
$ echo abcdef
[echo]
bash: abcdef: command not found
$

--
Koichi



Latest push for command substitutions

2021-06-22 Thread Chet Ramey

The latest devel branch push has a rewrite of parse_comsub() to recursively
call the parser (yyparse()). I was finally able to get all the state
working correctly, though it will probably only work with bison.

Please run it through any tests or scripts you have so we can shake out any
bugs early.

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/