Skip to content

Shell source "$VAR/path" resolves by bare stem: wrong edges to config.yml / lib/completion.bash, misses on repeated names #3598

Closed

Description

@squid-protocol

Problem

A shell source/. path that starts with a variable is resolved like a bare name:

  • source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.bash is captured as $XDG_CONFIG_HOME:-$HOME/.config, and resolves by stem config to .github/ISSUE_TEMPLATE/config.yml.
  • source "$rvm_path/scripts/completion" resolves by stem completion to lib/completion.bash, which is not scripts/completion.
  • source "${BASH_IT?}/themes/powerline/powerline.base.bash" draws nothing. Two files share the name, and the literal path after the variable, which would pick one, isn't used.

Measured

tests/tools/import_graph_accuracy.py shell (Bash-it/bash-it, added in #3594): precision 87.5%, recall 75.0%.

Fix direction

A new per-language flag for shell (and PowerShell's . "$PSScriptRoot\x.ps1"):

  • Strip everything up to and including the last variable expansion.
  • Resolve the remaining literal tail (themes/powerline/powerline.base.bash) only as a path mirror, i.e. the whole tail must end a real path.
  • No tail, or a tail without / after a variable, means no edge.
  • The capture should also stop at }/:- so ${X:-default} doesn't leak a default path.

Activity

  1. added
    bug
    core-engine
    on Sep 25, 2026
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

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions