Re: git: bd15d6ef126e - main - libarchive: Force GNU iconv compatibility on FreeBSD

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
Date: Thu, 28 May 2026 09:01:11 UTC
Dag-Erling Smørgrav <des@FreeBSD.org> writes:
> Antoine Brodin <antoine@freebsd.org> writes:
> > Could this change break some ports?
> Your logs show that LC_COLLATE is set to C.  It should be set to
> C.UTF-8, or simply not set at all since LANG is already C.UTF-8.

Hmm, this does not appear to be the correct answer.  It looks like the
ports tree is messing with the locale:

    des@crash /usr/ports/devel/py-game% export LANG=C.UTF-8
    des@crash /usr/ports/devel/py-game% export LC_COLLATE=C
    des@crash /usr/ports/devel/py-game% locale             
    LANG=C.UTF-8
    LC_CTYPE="C.UTF-8"
    LC_COLLATE=C
    LC_TIME="C.UTF-8"
    LC_NUMERIC="C.UTF-8"
    LC_MONETARY="C.UTF-8"
    LC_MESSAGES="C.UTF-8"
    LC_ALL=
    des@crash /usr/ports/devel/py-game% tar -xf /usr/ports/distfiles/pygame-2.6.1.tar.gz -C /tmp
    des@crash /usr/ports/devel/py-game% make BATCH= extract       
    ===>  License LGPL21 accepted by the user
    ===>   py311-game-2.6.1_5 depends on file: /usr/local/sbin/pkg - found
    ===> Fetching all distfiles required by py311-game-2.6.1_5 for building
    ===>  Extracting for py311-game-2.6.1_5
    => SHA256 Checksum OK for pygame-2.6.1.tar.gz.
    tar: Pathname can't be converted from UTF-8 to current locale
    tar: Pathname can't be converted from UTF-8 to current locale
    [...]
    des@crash /usr/ports/devel/py-game% cat >/tmp/tar 
    #!/bin/sh
    locale
    exec /usr/bin/tar "$@"
    des@crash /usr/ports/devel/py-game% chmod a+rx /tmp/tar
    des@crash /usr/ports/devel/py-game% make BATCH= extract EXTRACT_CMD=/tmp/tar
    ===>  License LGPL21 accepted by the user
    ===>   py311-game-2.6.1_5 depends on file: /usr/local/sbin/pkg - found
    ===> Fetching all distfiles required by py311-game-2.6.1_5 for building
    ===>  Extracting for py311-game-2.6.1_5
    => SHA256 Checksum OK for pygame-2.6.1.tar.gz.
    LANG=C
    LC_CTYPE="C"
    LC_COLLATE="C"
    LC_TIME="C"
    LC_NUMERIC="C"
    LC_MONETARY="C"
    LC_MESSAGES="C"
    LC_ALL=C
    tar: Pathname can't be converted from UTF-8 to current locale
    tar: Pathname can't be converted from UTF-8 to current locale
    [...]
    des@crash /usr/ports/devel/py-game% cd ../..
    des@crash /usr/ports% grep -w LANG Mk/bsd.port.mk 
    # USE_LOCALE	- LANG and LC_ALL are set to the value of this variable in
    LANG=		C
    .export		LANG LC_ALL
    WRK_ENV+=	LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE}

There we have it.  The ports tree should set LANG to C.UTF-8, not C.

DES
-- 
Dag-Erling Smørgrav - des@FreeBSD.org