[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected space in conditional taints subsequent conditional

From: Chet Ramey
Subject: Re: Unexpected space in conditional taints subsequent conditional
Date: Thu, 20 Oct 2022 10:18:39 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.3

On 10/19/22 12:31 AM, Todd Stein wrote:

Bash Version: 5.2
Patch Level: 2
Release Status: release

Including an erroneous space in a double-bracket conditional results in an
error, as it should, but it also taints the next conditional that gets
interpreted, forcing an an exit status of 2 regardless of syntax. This
taint persists through non-conditional commands.

Here's an example of the issue. Note that the first echo (in the third
command) does not execute -- the entire line seems to be eaten.

$ [[ a b ]]
bash: conditional binary operator expected

Thanks for the report. It's not the space, but the syntax error (`b' is not
a valid binary operator). The parser error recovery token doesn't result in
the parser state being reset correctly.

It's an interactive-only issue. It will be fixed in the next devel branch


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]