Skip to content

fix(bash): keep the literal suffix after the script-dir idiom's pwd) (#5560) - #5568

Closed
yashsaxena wants to merge 1 commit into
Graphify-Labs:v8from
yashsaxena:bash-pwd-suffix
Closed

yashsaxena wants to merge 1 commit into
Graphify-Labs:v8from
yashsaxena:bash-pwd-suffix

Conversation

@yashsaxena

Copy link
Copy Markdown
Contributor

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 for greet.sh in the wrong folder and gave no edge.
_bash_assignment_base now keeps the literal path after pwd) 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

  • Bug fix

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_tree ceilings is probed.
The suffix accepts only [A-Za-z0-9._-] segments and rejects .., so it can only go down.

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:

CI workflow (workflow_dispatch) on yashsaxena/graphify@bash-pwd-suffix: all jobs pass
(skillgen-check, test 3.11/3.12/3.13/3.14, pi-guard, security-scan)
test (3.12): 12063 passed, 119 skipped, 2 xfailed   (serial pass: 285 passed, 3 skipped)

Graphify-specific checklist

  • I updated generated skill artifacts: not needed, no fragments changed.
  • Extraction stays deterministic (no ENV reads).
  • Reviewed for security: no new filesystem probe outside existing gates.
  • No API keys or local graph data.
  • AI authorship disclosed in the commit message (Co-Authored-By: Claude).

…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]>
@github-actions

Copy link
Copy Markdown

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.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify review View in Graphify

Nothing blocking · 2 possible issues to check · Merge confidence 5/5

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

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

@yashsaxena yashsaxena closed this Nov 28, 2026
@yashsaxena yashsaxena reopened this Nov 28, 2026
@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.123, landed via authorship-preserving cherry-pick so your commits keep your name. Thanks @yashsaxena!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bash extractor: the script-dir idiom with a literal suffix (X="$(cd "$(dirname "$0")/.." && pwd)/lib/x") loses the suffix, so . "$X/f.sh" gets no edge

2 participants