Skip to content

fix(self-update): only remove complete profile lines#4960

Merged
rami3l merged 1 commit into
rust-lang:mainfrom
cachebag:profile-line-cleanup
Jul 13, 2026
Merged

fix(self-update): only remove complete profile lines#4960
rami3l merged 1 commit into
rust-lang:mainfrom
cachebag:profile-line-cleanup

Conversation

@cachebag

@cachebag cachebag commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Perusing older issues; this PR fixes #2967 by preventing shell profile cleanup from removing rustup source commands embedded within larger shell expressions.

Cleanup previously matched arbitrary byte substrings, which could truncate guarded commands such as [ -f "$HOME/.cargo/env" ] && source "$HOME/.cargo/env". Matching now requires the command to begin at a line boundary; the existing trailing newline enforces the end boundary.

I found an earlier fix attempt in #3092 but it seemed to be abandoned and had a bit of a different approach.

Closes #2967

@cachebag cachebag force-pushed the profile-line-cleanup branch from 9b980ab to 49c7b04 Compare July 13, 2026 14:35
@rustbot

rustbot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rami3l rami3l left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/cli/self_update/unix.rs Outdated
@cachebag cachebag force-pushed the profile-line-cleanup branch from 49c7b04 to ec958cc Compare July 13, 2026 14:44
@cachebag cachebag requested a review from rami3l July 13, 2026 14:50
@rami3l rami3l enabled auto-merge July 13, 2026 14:53
@rami3l rami3l added this pull request to the merge queue Jul 13, 2026
Merged via the queue into rust-lang:main with commit 4fc19ff Jul 13, 2026
31 checks passed
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.

installer produced an invalid .bash_profile

3 participants