bug-bash
[Top][All Lists]
Advanced

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

EOF while in parse_matched_pair closes interactive shell


From: Eduardo A . Bustamante López
Subject: EOF while in parse_matched_pair closes interactive shell
Date: Tue, 21 Feb 2023 00:56:58 -0800

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -Wall
uname output: Linux system76-pc 6.1.0-4-amd64 #1 SMP PREEMPT_DYNAMIC Debian 
6.1.11-1 (2023-02-09) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

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

Description:

        The handling of EOF while parsing an (unmatched) quoted string changes
    between 5.1 and 5.2.  In 5.1, typing [Ctrl-d] alone while in the context of
    a quoted string in an interactive shell will report a syntax error, and
    prompt for a new command.  In 5.2, the same action does not report a syntax
    error, and instead the shell exits.

        I used to rely on [Ctrl-d] for getting out of a multiline string typed 
in
        error. I suppose I should be using [Ctrl-c] to that effect instead. Old
        habits die hard though, and I got curious about whether this change was
    intentional. The oldest version of bash I have access to is
    3.00.22(1)-release, and it behaves the same way as 5.1.

Repeat-By:

        Please find the transcript of 3 terminal sessions illustrating the
    difference in behavior between 5.2.15(1)-release, 5.2.15(7)-maint and
        5.1.0(3)-release.  Terminal input is denoted as [INPUT], e.g. [Ctrl-d]

    $ bash --norc
    bash-5.2$ echo $BASHPID
    132773
    bash-5.2$ 
    GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)
    bash-5.2$ echo '
    >[Ctrl-d]
    bash: unexpected EOF while looking for matching `''
    >[Enter]
    (Shell exits)
    
    $ ./bash --norc
    bash-5.2$ echo $BASHPID
    132768
    bash-5.2$ 
    GNU bash, version 5.2.15(7)-maint (x86_64-pc-linux-gnu)
    bash-5.2$ echo '
    >[Ctrl-d]
    bash: unexpected EOF while looking for matching `''
    (Shell exits)
    
    $ ./bash --norc
    bash-5.1$ echo $BASHPID
    132662
    bash-5.1$ 
    GNU bash, version 5.1.0(3)-release (x86_64-pc-linux-gnu)
    bash-5.1$ echo '
    >[Ctrl-d]
    bash: unexpected EOF while looking for matching `''
    bash: syntax error: unexpected end of file
    bash-5.1$ echo $BASHPID
    132662



reply via email to

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