Trepan-Debuggers / Trepan-Debuggers/bashdb
Recursively debugging using "debug" doesn't preserve cli args
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 98
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
I was debugging a bash script whose stdin and stdout were not my tty (a git hook, to be precise), and passed --tty /dev/tty --tty_in /dev/tty which worked great to be able to debug that initial script.
However, that script ran some other scripts, and attempting to recursively step into those with the default "debug" command didn't work because that sub-invocation of bashdb didn't preserve the --tty and --tty_in arguments.
To reproduce the problem:
# Create a minimal git repo
git init myrepo
cd myrepo
touch foo ; git add foo ; git commit -m foo foo
# Set up the hook scripts:
cat <<EOF > .git/hooks/post-checkout
bashdb --tty /dev/tty --tty_in /dev/tty /tmp/somescript
EOF
chmod +x .git/hooks/post-checkout
echo "/tmp/otherscript" > /tmp/somescript
echo "echo end of somescript" >> /tmp/somescript
echo "echo in otherscript" > /tmp/otherscript
echo "echo another line" >> /tmp/otherscript
chmod +x /tmp/*script
git checkout HEAD # Trigger the hook
Then enter debug on the /tmp/otherscript line, and notice that you don't end up debugging it, the inner bashdb immediately quits with "That's all, folks..."
I'm guessing that many of the other cli args should be preserved to sub-bashdb invocations as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided git hook setup and the recursive "debug" command. Start by tracing how the recursive bashdb invocation is built, then verify that --tty /dev/tty and --tty_in /dev/tty are preserved so /tmp/otherscript enters the debugger instead of quitting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100