Skip to content

fix: make bin root detection CDPATH-safe#836

Open
Gujiassh wants to merge 1 commit intogarrytan:mainfrom
Gujiassh:fix/cdpath-safe-bin-root
Open

fix: make bin root detection CDPATH-safe#836
Gujiassh wants to merge 1 commit intogarrytan:mainfrom
Gujiassh:fix/cdpath-safe-bin-root

Conversation

@Gujiassh
Copy link
Copy Markdown

@Gujiassh Gujiassh commented Apr 5, 2026

Summary

  • make all affected bin/ scripts suppress cd stdout while resolving GSTACK_DIR
  • prevent CDPATH from injecting an extra path line into $(cd ... && pwd) command substitutions and corrupting downstream file paths
  • cover the most user-visible path (gstack-update-check) with a manual reproduction that now succeeds under CDPATH

Fixes #824.

Testing

  • bash -n bin/dev-setup bin/dev-teardown bin/gstack-community-dashboard bin/gstack-telemetry-log bin/gstack-telemetry-sync bin/gstack-uninstall bin/gstack-update-check
  • tmpdir=$(mktemp -d) && printf '999.0.0\n' > "$tmpdir/VERSION" && export CDPATH='.:/tmp' && export GSTACK_STATE_DIR="$tmpdir/state" && export GSTACK_REMOTE_URL="file://$tmpdir/VERSION" && bin/gstack-update-check --force

Redirect the bootstrap cd command to /dev/null so CDPATH cannot inject an extra path line into GSTACK_DIR and corrupt script-local path resolution.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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.

CDPATH breaks all bin/ scripts — cd outputs path to stdout, corrupting variable assignments

1 participant