Skip to content

fix: prepend brew bin when sourcing completions to prevent spurious errors on terminal open#22

Open
hanthor wants to merge 1 commit into
ublue-os:mainfrom
hanthor:fix/brew-completions-path
Open

fix: prepend brew bin when sourcing completions to prevent spurious errors on terminal open#22
hanthor wants to merge 1 commit into
ublue-os:mainfrom
hanthor:fix/brew-completions-path

Conversation

@hanthor

@hanthor hanthor commented May 22, 2026

Copy link
Copy Markdown

Brew completion scripts (e.g. just's eval "$(JUST_COMPLETE=bash just)") invoke their own binary by name. Since brew bin is appended after system bin in PATH, a system-installed version is found first. If it doesn't support the same flags, it spews errors on every terminal open (error: No justfile found from /usr/bin/just on Bluefin).

Fix: temporarily prepend brew bin while sourcing completions, restore PATH after.

Copilot AI review requested due to automatic review settings May 22, 2026 06:05

Copilot AI 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.

Pull request overview

This PR aims to eliminate spurious stderr output at shell startup caused by Homebrew-provided bash completion scripts invoking their own binaries (by name) when system PATH precedence resolves to an incompatible system-installed version.

Changes:

  • Temporarily prepends Homebrew bin/sbin to PATH while sourcing bash completion scripts, then restores the original PATH.
  • Introduces a BREW_VERSION file and uses it in the build workflow to add an image tag matching the version.
  • Updates Renovate configuration to track updates to BREW_VERSION from Homebrew/brew GitHub releases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
system_files/etc/profile.d/brew-bash-completion.sh Temporarily adjusts PATH during completion sourcing to avoid invoking incompatible system binaries.
BREW_VERSION Adds a single-source version value intended for CI tagging (and Renovate updates).
.github/workflows/build.yml Reads BREW_VERSION and adds it as a docker/metadata-action tag.
.github/renovate.json5 Switches regex manager to update BREW_VERSION based on Homebrew/brew releases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +148 to +151
- name: Read Brew Version
id: brew_version
run: echo "version=$(cat BREW_VERSION)" >> $GITHUB_OUTPUT


- name: Read Brew Version
id: brew_version
run: echo "version=$(cat BREW_VERSION)" >> $GITHUB_OUTPUT
Comment thread .github/renovate.json5
Comment on lines +9 to 15
"fileMatch": ["^BREW_VERSION$"],
"matchStrings": [
"https://github\\.com/ublue-os/artwork/releases/download/bluefin-v(?<version>[0-9\\-]+)/bluefin-wallpapers\\.tar\\.zstd"
"^(?<currentValue>.*)"
],
"datasourceTemplate": "github-releases",
"depNameTemplate": "ublue-os/artwork"
"depNameTemplate": "Homebrew/brew"
}
Comment thread BREW_VERSION
@@ -0,0 +1 @@
5.0.8
…rrors

Brew completion scripts (e.g. just's `eval "$(JUST_COMPLETE=bash just)"`)
invoke their own binary by name. Because this script appends brew's bin
after system bin in PATH (to protect system binaries), a system-installed
version of the same tool is found first. If that system version does not
support the same flags as the brew version, it prints errors to stderr on
every new terminal open (e.g. `error: No justfile found` from just).

Temporarily prepend brew's bin/sbin while sourcing the completion files so
that these scripts call the correct brew binary, then restore the original
PATH afterwards. The user's runtime PATH is unchanged after setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hanthor hanthor force-pushed the fix/brew-completions-path branch from 26bd03a to 5a45232 Compare May 22, 2026 06:26
@renner0e

Copy link
Copy Markdown
Member

I think you are hitting casey/just#3188 here

@hanthor

hanthor commented May 22, 2026

Copy link
Copy Markdown
Author

Its actually a bit dangerous if you open a new terminal in a drop with a justfile

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.

3 participants