Donnie Berkholz wrote:
> On 17:53 Wed 26 Sep , Doug Goldstein wrote:
>> Mike Frysinger wrote:
>> > Donnie Berkholz wrote:
>> > also, ebuilds do change over time, so what line # may be correct one
>> > day may not be relevant the next ...
>> >
>>
>> Which could bring up a point of would it be useful to see if we can
>> print out the actual line that caused the die. Now, I don't know if this
>> feasible or something the Portage devs want to do. But again, in the
>> effort to streamline this might be something to consider.
>
> The backtrace code is in ebuild.sh:dump_trace(). If you can find a way
> in bash to print the source line, that would be great. I took another
> glance through the bash man page and didn't see much from that end. But
> since we do have the source file and line number, we could just grab it
> with some hack like:
>
> sed -ne "${lineno}p" ${filename}
>
> Anyone got something better?
>
This is from abort() in update (unreleased):
abort() {
f="Internal error in ${FUNCNAME[1]}(${BASH_LINENO[0]})"
[EMAIL PROTECTED]
if ((n>3)); then
for ((i=2;i<n-1;i++)); do
f+=" :${FUNCNAME[i]}(${BASH_LINENO[i-1]})"
done
f+=" : line ${BASH_LINENO[i-1]}"
fi
echo "!! $prog: $f"
}
- which provides a stacktrace for a bash script calling abort in the same
way as die is used. It _really_ helps for debugging (it doesn't always get
used, depending on how abort is called.)
HTH.
--
[EMAIL PROTECTED] mailing list