From bfa763a55bcb96f0eb777311a9af79b22fddb73f Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Sat, 5 Sep 2026 22:33:35 +0300 Subject: [PATCH] fix(install): cover a non-login interactive bash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ~/.bashrc was only appended to when it already existed, so on an account without one — a fresh container, a minimal image — `bash -i`, which is what most Linux terminal emulators start, did not see the toolchain even though every other shell did. .bashrc is now created when missing. Unlike .bash_profile, whose existence stops bash reading ~/.profile, a .bashrc that only sources the env file changes nothing else about how bash starts. Verified across zsh -i, zsh -c, bash -l, bash -i, sh -l and dash -l on a staged HOME: all six resolve ludic, a second run writes nothing, and .bash_profile is still never created. Co-Authored-By: Claude Opus 5 --- changes/bashrc-noninteractive.md | 7 +++++++ install.sh | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 changes/bashrc-noninteractive.md diff --git a/changes/bashrc-noninteractive.md b/changes/bashrc-noninteractive.md new file mode 100644 index 00000000..566a0a7f --- /dev/null +++ b/changes/bashrc-noninteractive.md @@ -0,0 +1,7 @@ +bump: patch +type: fix +The installer also covers a non-login interactive `bash` — the shell most Linux +terminal emulators start, which reads only `~/.bashrc`. That file is now created +when it is missing (its presence changes nothing else about how bash starts), +while `~/.bash_profile` is still only appended to when it already exists, since +creating that one would stop bash reading `~/.profile`. diff --git a/install.sh b/install.sh index 5e930734..f4bc70c5 100755 --- a/install.sh +++ b/install.sh @@ -267,7 +267,7 @@ add_line() { return 0 fi mkdir -p "$(dirname "$_file")" 2>/dev/null || true - printf '\n# ludic\n%s\n' "$_line" >> "$_file" || { + printf '\n# ludic\n%s\n' "$_line" >> "$_file" 2>/dev/null || { warn "could not write ${_file}" return 0 } @@ -281,9 +281,14 @@ add_to_path() { add_line "${HOME}/.profile" "$_posix" add_line "${ZDOTDIR:-$HOME}/.zshenv" "$_posix" - # bash: only files that already exist, so we never shadow ~/.profile + # bash reads ~/.bashrc for a non-login interactive shell — what most Linux + # terminal emulators start — and it is safe to create, since its presence + # changes nothing else. ~/.bash_profile is only appended to when it already + # exists: creating that one would stop bash reading ~/.profile. [ -f "${HOME}/.bash_profile" ] && add_line "${HOME}/.bash_profile" "$_posix" - [ -f "${HOME}/.bashrc" ] && add_line "${HOME}/.bashrc" "$_posix" + if [ -f "${HOME}/.bashrc" ] || have bash; then + add_line "${HOME}/.bashrc" "$_posix" + fi if have fish || [ -f "${HOME}/.config/fish/config.fish" ]; then add_line "${HOME}/.config/fish/config.fish" "source \"${INSTALL_DIR}/env.fish\"" fi