Fix breakpoint hit in file sourced with relative path after script changed the working directory #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The script (shown below) of my integration tests of BashSupport Pro failed to hit a breakpoint in the function definition of
include3.sh
.The breakpoint was not hit because the lookup in
hook.sh
was not using the current working directory of the script to find a path by relative path. In this case../dir3/include3.sh
was not looked inside the PWD$DIR/dir2
but only elsewhere.This PR changes the file lookup to always use the configured lookup directories
_Dbg_dir
as fallback if the lookup of absolute and relative paths did not yield a valid result.Also, the result of the lookup based on
_Dbg_dir
was not checked against$_Dbg_filenames
like the lookup a few lines above.Tests are passing and the breakpoint is now hit. But I'm not sure how to add a test case for this.
Question:
This code looks suspiciously similar to the code I changed. Should I change this, even though I'm not sure how it's used?
bashdb/lib/file.sh
Lines 104 to 118 in b78910a
Script of my test case