[bitbake-devel,2/2] build: report correct line number for failing Bash shell tasks

Submitted by Chris Laplante via lists.openembedded.org on July 31, 2020, 10:34 p.m. | Patch ID: 174975

Details

Message ID 20200731223442.102095-2-chris.laplante@agilent.com
State New
Headers show

Commit Message

Chris Laplante via lists.openembedded.org July 31, 2020, 10:34 p.m.
For EXIT traps, ${BASH_LINENO[0]} gives the wrong line. We want
${BASH_LINENO[1]} here.

Before:
| install: cannot stat 'source': No such file or directory
| WARNING: /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.101649:1 exit 1 from 'install -m 0644 source dest'

After:
| install: cannot stat 'source': No such file or directory
| WARNING: /home/laplante/repos/oe-core/build/tmp-glibc/work/core2-64-oe-linux/libsolv/0.7.14-r0/temp/run.do_compile.101649:115 exit 1 from 'install -m 0644 source dest'

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/build.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 977b02fc..6ad20ce7 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -310,7 +310,7 @@  bb_exit_handler() {
     0)  ;;
     *)  case $BASH_VERSION in
         "") echo "WARNING: exit code $ret from a shell command.";;
-        *)  echo "WARNING: ${BASH_SOURCE[0]}:${BASH_LINENO[0]} exit $ret from '$BASH_COMMAND'";;
+        *)  echo "WARNING: ${BASH_SOURCE[0]}:${BASH_LINENO[1]} exit $ret from '$BASH_COMMAND'";;
         esac
         exit $ret
     esac