Skip to content

Bash extractor: bash "$ROOT/lib/x.sh" and "$ROOT/bin/tool" (ROOT the script-dir idiom with ..; extensionless bash target) get no edge #5566

Backlog

Description

@yashsaxena

What happens

A script runs another script by a path built from the script-dir idiom:

ROOT="$(cd "$(dirname "$0")/.." && pwd)"
bash "$ROOT/lib/job.sh" build
"$ROOT/bin/helper" --flag        # no extension, bash shebang

Graphify gives no edge for either run.
#3416 (closed) reported the "$script_dir/x.sh" form; on 0.9.122 these two forms still give nothing:
a $VAR/x path where VAR is the idiom with a .., and a target with no .sh extension but a bash shebang (#2171 handled such files for source, not for runs).

Reproduced on graphifyy 0.9.122 (newest on PyPI), installed with pip, nothing patched, Python 3.12, Ubuntu.

Reproduction

Three files in a new git repo:

# bin/tool
#!/usr/bin/env bash
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
bash "$ROOT/lib/job.sh" build
"$ROOT/bin/helper" --flag
# bin/helper
#!/usr/bin/env bash
echo "helper $1"
# lib/job.sh
#!/usr/bin/env bash
echo "job $1"

Command:

graphify extract "$PWD" --code-only --out /tmp/out
jq -r '.links[] | select(.relation != "contains" and .relation != "defines")
       | "\(.relation) \(.source) -> \(.target)"' /tmp/out/graphify-out/graph.json

Expected

calls bin/tool -> lib/job.sh
calls bin/tool -> bin/helper

Got

(no edges)

Suggested fix

In the exec branch, resolve "$VAR/x" (by name, or as bash/sh's first argument) the way the source branch does, using the value VAR was set to in the file (including the script-dir idiom).
Accept a target with no extension when its first line is a bash or sh shebang.

Activity

  1. github-actions commented on Nov 28, 2026

    @github-actions

    Thanks for opening this issue, @yashsaxena. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions