All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chris Laplante" <chris.laplante@agilent.com>
To: <bitbake-devel@lists.openembedded.org>
Cc: Chris Laplante <chris.laplante@agilent.com>
Subject: [PATCH 2/2] build: report correct line number for failing Bash shell tasks
Date: Fri, 31 Jul 2020 18:34:42 -0400	[thread overview]
Message-ID: <20200731223442.102095-2-chris.laplante@agilent.com> (raw)
In-Reply-To: <20200731223442.102095-1-chris.laplante@agilent.com>

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(-)

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
-- 
2.17.1


      reply	other threads:[~2020-07-31 22:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 22:34 [PATCH 1/2] data: emit filename/lineno information for shell functions Chris Laplante
2020-07-31 22:34 ` Chris Laplante [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200731223442.102095-2-chris.laplante@agilent.com \
    --to=chris.laplante@agilent.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.