fix(terminal): fix iTerm2 prefs chown path and username variable#79
Merged
smartwatermelon merged 1 commit intomainfrom Mar 10, 2026
Merged
Conversation
Two bugs in copy_iterm2_preferences_to_user():
1. Line 338: `${operator_library_prefs_dir}/${preferences_file}` built
a double-path when preferences_file is an absolute path (e.g.
/Users/foo/Downloads/.../com.googlecode.iterm2.plist), causing
chown to fail with "No such file or directory" and crashing
first-boot.sh. Fix: use $(basename "${preferences_file}") to extract
just the filename before appending to the target directory.
2. Lines 339/341/343: `"{username}"` missing $ — bash expanded it as
the literal string "{username}" rather than the variable value,
so sudo -iu ran as an undefined user. Fix: "${username}".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Summary
Two bugs in
copy_iterm2_preferences_to_user()inscripts/server/setup-terminal-profiles.shthat caused first-boot.sh to crash during iTerm2 preferences setup:Double-path bug (line 338):
${operator_library_prefs_dir}/${preferences_file}— whenpreferences_fileis an absolute path (as it is when copied from the airdrop package), this constructs a malformed double-path like/Users/operator/Library/Preferences//Users/andrewrich/Downloads/tilsit-setup/config/com.googlecode.iterm2.plist. Thechowncall fails with "No such file or directory," which causes the surroundingifblock to take theelsebranch,collect_errorfires, andfirst-boot.shexits with a non-zero status. Fix:$(basename "${preferences_file}")extracts just the filename.Missing
$on variable (lines 339/341/343):"{username}"is a literal string — bash does not expand it. Everysudo -iu "{username}"call silently runs as an undefined user. Fix:"${username}".Test plan
first-boot.shon TILSIT (or a clean test) withUSE_ITERM2=trueand confirm iTerm2 preferences are copied without errorchowntarget path is/Users/operator/Library/Preferences/com.googlecode.iterm2.plist(not a double-path)🤖 Generated with Claude Code