bug-bash
[Top][All Lists]
Advanced

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

line numbers are false after (...) || {...}


From: kovacs istvan
Subject: line numbers are false after (...) || {...}
Date: Thu, 21 Oct 2021 15:33:11 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall 
-Wno-parentheses -Wno-format-security
uname output: Linux mamita 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 
(2021-07-18) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 3
Release Status: release

Description:
After the below described construct, the line numbers are off, this affects 
both the envvar LINENO and the line numbers bash writes on an error.
 
It seems that the newlines in {} are ignored, if it is after "() ||" or "() &&" 
.

 

Also tested with `true || { ... }` and { ... } || { ... } . In those cases the 
correct line numbers are shown.

Repeat-By:
#!/bin/bash

( echo foo; ) || {<!-- -->
    echo bar    # 4.line
    echo bar    # 5.line
    }           # 6.line
echo lineno: $LINENO   # 7.line
[[ -e bla]]     # 8.line

output:

foo
lineno: 4
./tester.sh: line 5: unexpected EOF while looking for `]]'
./tester.sh: line 6: syntax error: unexpected end of file

 

=> The reported line-numbers are 2 lines off.


reply via email to

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