Fix resolving of relative script paths #62
Draft
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.
At first, the script's working directory is used to resolve a relative path. Then, the script's parent directory is used. This commit removes duplicated code shared between file.sh and filecache.sh.
_Dbg_dir=('\$cdir' '\$cwd' )
to_Dbg_dir=('\$cwd' '\$cdir' )
, because IMHO the current working directory should be looked at first. At runtime, that's what the debuggee does (I suppose)typeset _Dbg_cdir="${_Dbg_source_file%/*}"
totypeset _Dbg_cdir="${_Dbg_init_cwd%/*}"
because that seems more suitable to reference the script's location. Indbg-main.sh
variable_Dbg_source_file
is used in a loop (without a break) and does not seem to refer to the debuggee script passed tobashdb
. Because of the missing break, I think it's always set to$DBG_RESTART_FILE
when the loop is done.Supersedes #61
Update: This is breaking other cases, discussed in #63