Repository navigation
fix(bash): keep the literal suffix after the script-dir idiom's pwd) (#5560) - #5568
Closed
yashsaxena wants to merge 1 commit into
Closed
yashsaxena wants to merge 1 commit into
yashsaxena wants to merge 1 commit into
Conversation
…raphify-Labs#5560) X="$(cd "$(dirname "$0")/.." && pwd)/lib/x" now resolves to lib/x, so . "$X/f.sh" finds lib/x/f.sh. A suffix with .. is not followed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @yashsaxena. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify review 
2 possible issues to check · High impact
The extractor now adds a literal path suffix after a Bash pwd) idiom to the tracked assignment base.
2 possible issues we couldn't confirm
- A literal path inside the
cdargument is dropped, so the base folder ends up one level too high ·graphify/extractors/bash.py:163 - A suffix containing
..is silently dropped, so the variable is bound to the wrong folder instead of being left untracked ·graphify/extractors/bash.py:162
They don't change the score.
Code graph · 623 functions depend on this change
- 1 function became more coupled.
extract_bash()(54 callers). - 2 of 652 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed 9d0193d
Member
|
Shipped in v0.9.123, landed via authorship-preserving cherry-pick so your commits keep your name. Thanks @yashsaxena! |
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Fixes #5560.
A variable set to the script-dir idiom with a literal path after it, as in
LIB="$(cd "$(dirname "$0")/.." && pwd)/lib/x", was tracked as the idiom's folder alone, so. "$LIB/greet.sh"looked forgreet.shin the wrong folder and gave no edge._bash_assignment_basenow keeps the literal path afterpwd)as part of the variable's folder.A path with
..in it is not followed: the folder stays the idiom's, as before.Type of change
Verification & Invariants
Invariant: a tracked variable's folder is only ever the script's folder, its parents by
/..hops, or a literal path below that; nothing outside the existing_within_treeceilings is probed.The suffix accepts only
[A-Za-z0-9._-]segments and rejects.., so it can only go down.X="$(cd "$(dirname "$0")/.." && pwd)/lib/x") loses the suffix, so. "$X/f.sh"gets no edge #5560, on graphifyy 0.9.122 from PyPI).test_extract_bash_var_source_script_dir_idiom_keeps_literal_suffixfails without the fix (nobash_sourcesentry), and..._dotdot_suffix_ignoredguards the..case.How was this tested?
I could not run the suite on my machine, so this repo's own CI workflow ran on the branch in my fork:
Graphify-specific checklist