Gentoo Archives: gentoo-dev

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in app-portage/genlop: ChangeLog genlop-0.30.8.ebuild
Date: Thu, 27 Sep 2007 16:11:42
Message-Id: fdgjie$9oe$1@sea.gmane.org
In Reply to: Re: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in app-portage/genlop: ChangeLog genlop-0.30.8.ebuild by Donnie Berkholz
1 Donnie Berkholz wrote:
2 > On 17:53 Wed 26 Sep , Doug Goldstein wrote:
3 >> Mike Frysinger wrote:
4 >> > Donnie Berkholz wrote:
5 >> > also, ebuilds do change over time, so what line # may be correct one
6 >> > day may not be relevant the next ...
7 >> >
8 >>
9 >> Which could bring up a point of would it be useful to see if we can
10 >> print out the actual line that caused the die. Now, I don't know if this
11 >> feasible or something the Portage devs want to do. But again, in the
12 >> effort to streamline this might be something to consider.
13 >
14 > The backtrace code is in ebuild.sh:dump_trace(). If you can find a way
15 > in bash to print the source line, that would be great. I took another
16 > glance through the bash man page and didn't see much from that end. But
17 > since we do have the source file and line number, we could just grab it
18 > with some hack like:
19 >
20 > sed -ne "${lineno}p" ${filename}
21 >
22 > Anyone got something better?
23 >
24 This is from abort() in update (unreleased):
25 abort() {
26 f="Internal error in ${FUNCNAME[1]}(${BASH_LINENO[0]})"
27 n=${#FUNCNAME[@]}
28 if ((n>3)); then
29 for ((i=2;i<n-1;i++)); do
30 f+=" :${FUNCNAME[i]}(${BASH_LINENO[i-1]})"
31 done
32 f+=" : line ${BASH_LINENO[i-1]}"
33 fi
34 echo "!! $prog: $f"
35 }
36 - which provides a stacktrace for a bash script calling abort in the same
37 way as die is used. It _really_ helps for debugging (it doesn't always get
38 used, depending on how abort is called.)
39 HTH.
40
41
42 --
43 gentoo-dev@g.o mailing list