Repository navigation
ssh-agent-install no longer stops on an rc file it cannot write: it installs the agent and names the file - #134
Merged
Conversation
An rc of mode 0444, or one linked into a read-only store, ended the installer at its `>>` with the shell's own "Permission denied" and exit 1 (#131). By then the LaunchAgent was loaded and the rc files before that one written: an install done in part, with no closing line and no word on which file or what to do. Refusing would serve nobody who has the problem: the owner of an rc linked into a read-only store cannot make it writable, and the agent needs nothing from that file. So which rc gets the line is settled before anything is loaded. One that cannot be written is passed over: the agent is installed, the others are written, and the closing line names it with the exact line to add by hand. Exit 0. A link to nothing is passed over the same way. Uninstall does the same with an rc it cannot take its line out of, and tells the two lines it may leave apart: this install's is guarded on the env file, which is gone, and does nothing now; an earlier install's fixed export is not, and still sets SSH_AUTH_SOCK to a socket nothing serves, so that one is named with the line to take out. test-binary.sh, 6c: a ~/.zshrc of mode 0444, and a ~/.bash_profile linked to a read-only file, each under a throwaway HOME. The installer must exit 0, name the file with the line, leave it as it was (and a link a link), write ~/.bashrc; run again it must change nothing and name it again. Then the line is added by hand, as the installer said, and the file locked again: uninstall must exit 0, name it, leave it as it is and leave no .tmp beside it. And a locked ~/.profile holding the old export: uninstall must say it still sets the variable, and must not say it does nothing. On main's installer the section stops at "stopped on an rc it cannot write"; so does this one with its check taken out on the install side, and on the uninstall side at the uninstall; with the two lines not told apart it stops at the export's row. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: closer-claudio <claudio@farcloser.world>
closer-claudio
force-pushed
the
claudio/20261116-unwritable-rc
branch
from
November 16, 2026 06:31
49f588c to
7f2af90
Compare
closer-claudio
marked this pull request as ready for review
November 16, 2026 06:37
closer-claudio
enabled auto-merge
November 16, 2026 06:38
Contributor
Author
|
Reviewed at 7f2af90 |
1 similar comment
Contributor
Author
|
Reviewed at 7f2af90 |
apostasie
approved these changes
Nov 16, 2026
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.
🎯 Why
An rc of mode 0444, or one linked into a read-only store, ended
ssh-agent-installat its>>with the shell's own "Permission denied" and exit 1: #131. By then the LaunchAgent was loaded and the rc files before that one written: an install done in part, with no closing line and no word on which file or what to do.Refusing up front would serve nobody who has the problem: the owner of an rc linked into a read-only store cannot make it writable, and the agent needs nothing from that file.
🛠️ What
agent/ssh-agent-install: which rc gets the line is settled before anything is loaded. One that cannot be written (mode 0444, a link to a read-only file, a link to nothing) is passed over: the agent is installed, the others are written, and the closing line names it with the exact line to add by hand. Exit 0. Uninstall does the same with an rc it cannot take its line out of, and tells apart the two lines it may leave: this install's, which is guarded and does nothing once the env file is gone, and an earlier install's fixedexport, which still setsSSH_AUTH_SOCKand is named with the line to take out.test-binary.sh, 6c: a~/.zshrcof mode 0444, and a~/.bash_profilelinked to a read-only file, each under a throwawayHOME. The installer must exit 0, name the file with the line, leave it as it was (a link stays a link), write~/.bashrc; run again it must change nothing and name it again. Then the line is added by hand and the file locked again: uninstall must exit 0, name it, leave it as it is and leave no.tmpbeside it. And a locked~/.profileholding the old export: uninstall must say it still sets the variable.README.md: one sentence under "The agent".🧪 How
just lintgreen.📝 Notes
strip_linescan replace an rc with a truncated copy when a write fails: ssh-agent-install can replace an rc with a truncated copy when a write fails #135, older than this change and not in it.