A patch level upgrade of 14.2-RELEASE-p⯠to 14.2-RELEASE-p5 overwrites: /root/.cshrc If it helps: pkgbasify _does_ respect (at least) /root/.cshrc ---- root@pkg:~ # pkg which /root/.cshrc /root/.profile /root/.cshrc was installed by package FreeBSD-csh-14.2p5 /root/.profile was installed by package FreeBSD-runtime-14.2p5 root@pkg:~ # freebsd-version -kru ; uname -mvKU 14.2-RELEASE-p5 14.2-RELEASE-p2 14.2-RELEASE-p5 FreeBSD 14.2-RELEASE-p2 releng/14.2-n269518-ac2cbb46b5f1 GENERIC amd64 1402000 1402000 root@pkg:~ # ---- Originally reported by u/vivekkhera for FreeBSD-csh-14.3p2 at <https://www.reddit.com/r/freebsd/comments/1mzlfq0/comment/naku34i/?context=2>.
Created attachment 263230 [details] Screenshot of vt(4) following a minor upgrade A minor upgrade from 14.2-RELEASE-p2 to 14.3-RELEASE-p2 lost (overwrote) my customisations to both /root/.cshrc and /root/.profile - prior to the upgrade, both files included a custom line for EDITOR.
> both files included a custom line for EDITOR. More accurately, my customisation of /root/.cshrc was _removal_ of the line for EDITOR.
this is because the hard links /.profile and /.cshrc are missing the config tag, which makes pkg overwrite them instead of attempting to merge changes. for main, we already removed /.cshrc, so we can just remove /.profile as well: https://reviews.freebsd.org/D52161 for stable/14, adding the config tag to the links in / works around the problem: https://reviews.freebsd.org/D52162
Thank you! I should have thought of /.cshrc (subscription to <https://reviews.freebsd.org/D45382>, plus I manually removed /.cshrc.pkgsave from one of my test VMs before making this report). /etc/csh.cshrc and /etc/profile are already good, customisations do survive an upgrade. /usr/share/skel/dot.cshrc and /usr/share/skel/dot.profile lose customisation, I treat these as out of scope because there's no etc/ context. Re: comment 0 I have a question, which I'll not raise in Bugzilla or via email; I might ping you in Mastodon.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=aa730a66bc74696df85b21ec2719c75d8eab8c9f commit aa730a66bc74696df85b21ec2719c75d8eab8c9f Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2025-09-02 08:22:56 +0000 Commit: Lexi Winter <ivy@FreeBSD.org> CommitDate: 2025-09-02 08:22:56 +0000 sh: Add config tag to /.profile The file /.profile is installed as a hard link to /root/.profile. The file in /root has the config tag, but the file in / does not, which causes it to be overwritten by pkg upgrade. Since they're linked, this also overwrites the file in /root. Add the config tag to the file in / as well, so pkg treates both links as config files and won't overwrite them. PR: 289097 MFC after: 3 days Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D52162 bin/sh/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f103de98b855e69f1c0e1e90f7a174ae06acf892 commit f103de98b855e69f1c0e1e90f7a174ae06acf892 Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2025-09-02 08:22:56 +0000 Commit: Lexi Winter <ivy@FreeBSD.org> CommitDate: 2025-09-10 20:41:08 +0000 sh, csh: Add config tag to /.profile and /.cshrc The file /.profile is installed as a hard link to /root/.profile. The file in /root has the config tag, but the file in / does not, which causes it to be overwritten by pkg upgrade. Since they're linked, this also overwrites the file in /root. Add the config tag to the file in / as well, so pkg treates both links as config files and won't overwrite them. For stable/14, also add this to /.cshrc, which is no longer installed in 15.0. PR: 289097 MFC after: 3 days Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D52162 (cherry picked from commit aa730a66bc74696df85b21ec2719c75d8eab8c9f) sh: Fix non-NO_ROOT installconfig When building without NO_ROOT, ${TAG_ARGS} is not set, which means we pass ",config" as an install(1) argument. Only add the config tag if ${TAG_ARGS} is defined to begin with. Fixes: aa730a66bc74 ("sh: Add config tag to /.profile") Reported by: bz (cherry picked from commit b197d2abcb6895d78bc9df8404e374397aa44748) bin/csh/Makefile | 4 ++-- bin/sh/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d31e342bcc8e22d7eb25c21a711cd4b8a54db6c0 commit d31e342bcc8e22d7eb25c21a711cd4b8a54db6c0 Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2025-09-30 06:02:06 +0000 Commit: Lexi Winter <ivy@FreeBSD.org> CommitDate: 2025-09-30 06:02:06 +0000 sh: Remove /.profile root's home directory was moved to /root many years ago, so there's no reason to keep this old link. This brings sh in line with csh, where /.cshrc was removed in dcb65c5a94d4. Relnotes: yes Approved by: re (cperciva) MFC after: 1 day PR: 289097 Reviewed by: cperciva, jilles, bapt, emaste Differential Revision: https://reviews.freebsd.org/D52161 bin/sh/Makefile | 9 --------- 1 file changed, 9 deletions(-)
(In reply to commit-hook from comment #7) Maybe note this in UPDATING for main, and (after MFC) in a release note for 15.0.
Sorry, I didn't see the Relnotes: line.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=b4b91207ab6f38db33f853b2d6b3f1bb806f94f1 commit b4b91207ab6f38db33f853b2d6b3f1bb806f94f1 Author: Lexi Winter <ivy@FreeBSD.org> AuthorDate: 2025-09-30 06:02:06 +0000 Commit: Lexi Winter <ivy@FreeBSD.org> CommitDate: 2025-10-01 10:35:10 +0000 sh: Remove /.profile root's home directory was moved to /root many years ago, so there's no reason to keep this old link. This brings sh in line with csh, where /.cshrc was removed in dcb65c5a94d4. Relnotes: yes Approved by: re (cperciva) MFC after: 1 day PR: 289097 Reviewed by: cperciva, jilles, bapt, emaste Differential Revision: https://reviews.freebsd.org/D52161 (cherry picked from commit d31e342bcc8e22d7eb25c21a711cd4b8a54db6c0) bin/sh: Fix the build Removing <bsd.prog.mk> was unintentional; put it back. Fixes: d31e342bcc8e ("sh: Remove /.profile") MFC after: 1 day (cherry picked from commit bb0955ee4db8870bb013cf7d208ad9b2fc27b619) bin/sh/Makefile | 7 ------- 1 file changed, 7 deletions(-)
for non-pkgbase users, this doesn't need an UPDATING entry because the final version of the change doesn't remove an existing /.profile, so this doesn't affect updates. i thought this was preferable to potentially deleting a user's customised profile. possibly an UPDATING entry would be justified for pkgbase, but i doubt anyone was even aware this file existed except when it broke their pkgbase upgrades. in any case, the original bug should be fixed for both 14 and 15 now.