[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unintended interactive debugger behavior with `shopt -s extdebug`
From: |
Mike Frysinger |
Subject: |
unintended interactive debugger behavior with `shopt -s extdebug` |
Date: |
Sun, 8 Mar 2009 18:17:08 -0500 |
User-agent: |
KMail/1.11.1 (Linux/2.6.28; KDE/4.2.1; x86_64; ; ) |
we use "extdebug" in our scripts to get the extended BASH_ARGC and BASH_ARGV
info so that when an error does occur, we can construct and display a useful
backtrace of where things fell apart and how the script got there. this has
significantly cut down time otherwise spent on manual debugging.
unfortunately, using `shopt -s extdebug` implies --debugger in subshells --
something we most certainly do not want. but there doesnt seem to be a way to
get what we want (BASH_ARG{C,V}) without having the interactive debugger
launch on us with "hacky" scripts. i'm pretty sure this behavior is
unintended ... at least, the bash docs dont say anywhere that extdebug implies
the same behavior as when bash is run with --debugger.
if this is actually intended behavior, can we get said behavior changed ? or
an option so that we can control this ?
some real world examples would be openssl and rsstool. they have some shell
scripts which can be passed through other things. openssl can be run through
perl and a POSIX shell. rsstool can be run through a C compiler and a POSIX
shell. but they have to forgo the shebang at the top of the file in order to
get this behavior. which leads to the problem ...
a simple example ... while i am running the top shell interactively, the same
behavior can be seen with non-interactive shell scripts:
$ cat test.sh
echo moo
$ ./test.sh
moo
$ shopt -s extdebug
$ ./test.sh
debugger, release
Copyright 2002, 2003, 2004, 2006, 2007, 2008 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Bourne-Again Shell Debugger, release
Copyright 2002, 2003, 2004, 2006, 2007, 2008 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
debugger, release
Copyright 2002, 2003, 2004, 2006, 2007, 2008 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
(/home/vapier/test.sh:1):
1: echo moo
bashdb<0>
-mike
signature.asc
Description: This is a digitally signed message part.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- unintended interactive debugger behavior with `shopt -s extdebug`,
Mike Frysinger <=