[Bug 295668] Stale cross-encoding locale symlinks from FreeBSD 13 survive upgrade to FreeBSD 15, masking missing locale entries

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 28 May 2026 15:03:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295668

            Bug ID: 295668
           Summary: Stale cross-encoding locale symlinks from FreeBSD 13
                    survive upgrade to FreeBSD 15, masking missing locale
                    entries
           Product: Base System
           Version: 15.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: shirley.s@dell.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.