Bug 295668 - Stale cross-encoding locale symlinks from FreeBSD 13 survive upgrade to FreeBSD 15, masking missing locale entries
Summary: Stale cross-encoding locale symlinks from FreeBSD 13 survive upgrade to FreeB...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Dag-Erling Smørgrav
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-05-28 15:03 UTC by Shirley Shi
Modified: 2026-06-04 14:42 UTC (History)
3 users (show)

See Also:
des: mfc-stable15+
des: mfc-stable14+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shirley Shi 2026-05-28 15:03:05 UTC
Prior to commit 0a36787e4c1f ("locales: separate unicode from other locales", https://cgit.freebsd.org/src/commit/?id=0a36787e4c1fa0cf77dcf83be0867178476e372b, https://github.com/freebsd/freebsd-src/commit/0a36787e4c1fa0cf77dcf83be0867178476e372b), locale category Makefiles (e.g., share/msgdef/Makefile) were single combined files that contained both Unicode and non-Unicode entries. This allowed cross-encoding SAME entries such as:
SAME+=  nl_NL.UTF-8 nl_BE.ISO8859-1
SAME+=  nl_NL.UTF-8 nl_BE.ISO8859-15
SAME+=  sr_RS.UTF-8@latin hr_HR.ISO8859-2
SAME+=  sr_RS.UTF-8@latin sr_RS.ISO8859-2

These entries created symlinks where a non-Unicode locale's category file pointed to a UTF-8 locale's category file (e.g., nl_BE.ISO8859-1/LC_MESSAGES -> ../nl_NL.UTF-8/LC_MESSAGES).

That commit split each Makefile into separate unicode and non-unicode variants (e.g., share/msgdef/Makefile for non-Unicode, share/msgdef_unicode/Makefile for UTF-8). During this split, the cross-encoding entries above were dropped because the source locale (UTF-8) and the target locale (ISO8859) belong to different Makefiles.

When upgrading from FreeBSD 13 (pre-split) to FreeBSD 15 (post-split), the following stale symlinks from the pre-split era are not removed:
 14188        1 lrwxr-xr-x    1 root                             wheel                                  26 May 12  2022 /usr/share/locale/nl_BE.ISO8859-1/LC_MESSAGES -> ../nl_NL.UTF-8/LC_MESSAGES
 13864        1 lrwxr-xr-x    1 root                             wheel                                  26 May 12  2022 /usr/share/locale/nl_BE.ISO8859-15/LC_MESSAGES -> ../nl_NL.UTF-8/LC_MESSAGES
 14363        1 lrwxr-xr-x    1 root                             wheel                                  32 May 12  2022 /usr/share/locale/sr_RS.ISO8859-2/LC_MESSAGES -> ../sr_RS.UTF-8@latin/LC_MESSAGES
 14313        1 lrwxr-xr-x    1 root                             wheel                                  32 May 12  2022 /usr/share/locale/hr_HR.ISO8859-2/LC_MESSAGES -> ../sr_RS.UTF-8@latin/LC_MESSAGES

For comparison, symlinks that the current post-split Makefiles do create have the upgrade timestamp:
282968        1 lrwxr-xr-x    1 root                             wheel                                  28 Dec  2 17:52 /usr/share/locale/nl_BE.ISO8859-15/LC_CTYPE -> ../en_US.ISO8859-15/LC_CTYPE
289046        1 lrwxr-xr-x    1 root                             wheel                                  22 Dec  2 17:52 /usr/share/locale/nl_BE.ISO8859-15/LC_TIME -> ../nl_BE.UTF-8/LC_TIME
288427        1 lrwxr-xr-x    1 root                             wheel                                  29 Dec  2 17:52 /usr/share/locale/nl_BE.ISO8859-15/LC_NUMERIC -> ../tr_TR.ISO8859-9/LC_NUMERIC

These stale symlinks happen to still function correctly — the UTF-8 targets they point to exist, and the LC_MESSAGES content is pure ASCII (e.g., ja/nee for Dutch, da/ne for Croatian/Serbian), so there is no encoding mismatch. This means setlocale(LC_MESSAGES, "nl_BE.ISO8859-1") succeeds on upgraded systems.

However, on a clean FreeBSD 15 install (no upgrade), these symlinks don't exist and setlocale() returns NULL for these locales, because the post-split Makefiles never re-introduced equivalent non-Unicode entries. The stale symlinks on upgraded systems mask this underlying missing-entry bug. It is filed with bug #295666.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2026-05-28 22:15:00 UTC
^Triage: while this is undoubtedly true, one of the things you "just have to
know" about FreeBSD is that upgrades that skip a major version are not supported
(they may not even be well-tested).

So the reproducer would be to upgrade from 13 to 14 to 15 and see if it recurs.
Comment 2 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-05-29 15:51:46 UTC
https://reviews.freebsd.org/D57331
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-06-02 08:38:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1cef7e9eb0822c606fc34f975efd14b6daeff756

commit 1cef7e9eb0822c606fc34f975efd14b6daeff756
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-02 08:36:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-02 08:38:16 +0000

    ObsoleteFiles: Add some ancient locale symlinks

    These were dropped in 2021 but were never listed in ObsoleteFiles.inc,
    so systems that have been upgraded from source since before that date
    (or from 13.x) may still have them.

    PR:             295668
    MFC after:      1 week
    Fixes:          0a36787e4c1f ("locales: separate unicode from other locales")
    Reviewed by:    bapt
    Differential Revision:  https://reviews.freebsd.org/D57331

 ObsoleteFiles.inc | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 4 commit-hook freebsd_committer freebsd_triage 2026-06-04 14:41:02 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7546f06f5e0658ae0846116f42825d73479f9196

commit 7546f06f5e0658ae0846116f42825d73479f9196
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-02 08:36:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-04 14:40:18 +0000

    ObsoleteFiles: Add some ancient locale symlinks

    These were dropped in 2021 but were never listed in ObsoleteFiles.inc,
    so systems that have been upgraded from source since before that date
    (or from 13.x) may still have them.

    PR:             295668
    MFC after:      1 week
    Fixes:          0a36787e4c1f ("locales: separate unicode from other locales")
    Reviewed by:    bapt
    Differential Revision:  https://reviews.freebsd.org/D57331

    (cherry picked from commit 1cef7e9eb0822c606fc34f975efd14b6daeff756)

 ObsoleteFiles.inc | 7 +++++++
 1 file changed, 7 insertions(+)
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-06-04 14:41:05 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8bbe1d5422bc04e870482de6a0c05e769a106b1a

commit 8bbe1d5422bc04e870482de6a0c05e769a106b1a
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-02 08:36:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-04 14:40:29 +0000

    ObsoleteFiles: Add some ancient locale symlinks

    These were dropped in 2021 but were never listed in ObsoleteFiles.inc,
    so systems that have been upgraded from source since before that date
    (or from 13.x) may still have them.

    PR:             295668
    MFC after:      1 week
    Fixes:          0a36787e4c1f ("locales: separate unicode from other locales")
    Reviewed by:    bapt
    Differential Revision:  https://reviews.freebsd.org/D57331

    (cherry picked from commit 1cef7e9eb0822c606fc34f975efd14b6daeff756)

 ObsoleteFiles.inc | 7 +++++++
 1 file changed, 7 insertions(+)