Repository navigation
fix(install): create $(PREFIX)/bin on the sudo path - #152
Merged
Merged
Conversation
The install rule creates $(PREFIX)/bin only in its unprivileged branch:
the `mkdir -p` there is also the test, so when it fails for lack of
permission the sudo branch is taken without ever retrying it. install(1)
needs the destination directory to exist -- it writes a temp file beside
the target -- so on a machine without /usr/local/bin every file fails as
install: /usr/local/bin/INS@bHQl6a: No such file or directory
and the following `ln` fails the same way, aborting make.
That is the common case on macOS: Homebrew on Apple Silicon installs to
/opt/homebrew and leaves /usr/local an empty root-owned directory, so a
fresh checkout's `make install` could never succeed.
Create the directory with sudo before installing into it. BSD install on
macOS has no -D, so an explicit mkdir is the portable fix.
Co-authored-by: EvoAgent <evo@ruiqilei.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
make installfails on a machine without/usr/local/bin:Cause
The
installrule creates$(PREFIX)/binonly in its unprivileged branch. Thatmkdir -pis also the test for whether the directory is writable, so when it fails for lack of permission the sudo branch is taken without ever retrying it:if [ -w $(PREFIX)/bin ] || mkdir -p $(PREFIX)/bin 2>/dev/null && [ -w $(PREFIX)/bin ]; then ... else echo "Need sudo to write to $(PREFIX)/bin"; sudo install -m 755 build/evo-agent $(PREFIX)/bin/evo-agent; # dir never createdinstall(1)needs the destination directory to already exist — it writes a temp file (INS@xxxxxx) beside the target and renames it. With no/usr/local/bin, that temp file's path does not exist, hence theINS@…: No such file or directoryerrors. Thelnafter it fails for the same reason, and the non-zero exit abortsmake.This is the common case on macOS: Homebrew on Apple Silicon installs to
/opt/homebrewand leaves/usr/localan empty, root-owned directory. On such a machine a fresh checkout could never complete theREADME.mdquick start (make install, "enter your password if prompted") — the sudo path was the only one available, and it was broken.Fix
Create the directory in the privileged branch too:
echo "Need sudo to write to $(PREFIX)/bin"; \ + sudo mkdir -p $(PREFIX)/bin; \ sudo install -m 755 build/evo-agent $(PREFIX)/bin/evo-agent; \BSD
installon macOS has no-D, so an explicitmkdiris the portable fix.Verification
Reproduced the exact failure with a stand-in
sudothat runs the command as the invoking user against a read-onlyPREFIX, then confirmed the patched rule completes:The direct-write branch (writable
PREFIX) was already correct and still works.Co-authored-by: EvoAgent evo@ruiqilei.com