[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
declare -F incorrect line number
From: |
Daniel Castro |
Subject: |
declare -F incorrect line number |
Date: |
Sun, 2 Oct 2022 10:51:38 +0200 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-Smvct5/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux danicc097 5.4.0-126-generic #142-Ubuntu SMP Fri Aug
26 12:12:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 17
Release Status: release
Description:
declare -F yields the wrong line number for a function that has
nested functions declared within. Instead it gives the line number of
the last nested function.
Repeat-By:
```
#!/bin/bash
set -e
fn-a() {
echo "..."
echo "..."
echo "..."
nested-fn() {
:
}
nested-fn2() {
:
}
nested-fn
}
shopt -s extdebug
ln="$(declare -F fn-a)"
shopt -u extdebug
echo "$ln" # fn-a 14, should be 5
```
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]
- declare -F incorrect line number,
Daniel Castro <=
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/05
- RE: declare -F incorrect line number, Daniel Castro, 2022/10/05
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/05
- Re: declare -F incorrect line number, Robert Elz, 2022/10/05
- Re: declare -F incorrect line number, Chet Ramey, 2022/10/06
- Re: declare -F incorrect line number, Martin D Kealey, 2022/10/06
- Re: declare -F incorrect line number, Greg Wooledge, 2022/10/06
- Re: declare -F incorrect line number, Martin D Kealey, 2022/10/11
Re: declare -F incorrect line number, Chet Ramey, 2022/10/08