NetBSD Problem Report #59895
From leot@netbsd.org Tue Jan 6 22:54:27 2026
Return-Path: <leot@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "R13" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id E68751A923C
for <gnats-bugs@gnats.NetBSD.org>; Tue, 6 Jan 2026 22:54:26 +0000 (UTC)
Message-Id: <20260106225426.66A9F84DB1@mail.netbsd.org>
Date: Tue, 6 Jan 2026 22:54:26 +0000 (UTC)
From: leot@NetBSD.org
Reply-To: leot@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: bash-completion-2.17.0 started to error out `bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)`
X-Send-Pr-Version: 3.95
X-From4GNATS: "leot@NetBSD.org via gnats" <gnats-admin@NetBSD.org>
>Number: 59895
>Category: pkg
>Synopsis: bash-completion-2.17.0 started to erroring out `bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)`
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 06 22:55:00 +0000 2026
>Originator: Leonardo Taccari
>Release: NetBSD 10.1_STABLE
>Organization:
The NetBSD Foundation
>Environment:
System: NetBSD pinebookpro 10.1_STABLE NetBSD 10.1_STABLE (GENERIC64) #0: Fri Dec 26 12:53:23 UTC 2025 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
When using shells/bash-completion and having set LANG="en_US.UTF-8"
trying to complete possible globs spams the terminal with:
bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)
This seems a problem introduced with bash-completion-2.17.0.
Previous bash-completion-2.11 did not had such problem.
The completions are usable but this is pretty annoying.
>How-To-Repeat:
A simple reproducer that directly calls problematic function:
$ export LANG=en_US.UTF-8 # or assume that it is present in ~/.profile
[...]
$ _comp_expand_glob files '/tmp/reproducer-*'
bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8)
Interactively this can be reproduced via e.g.
man m<tab>
So, by typing "man m" and the tab character to complete.
>Fix:
Yes, please!
_comp_expand_glob() function of share/bash-completion/bash_completion
now have:
# To canonicalize the sorting order of the generated paths, we set
# LC_COLLATE=C and unset LC_ALL while preserving LC_CTYPE.
local LC_COLLATE=C LC_CTYPE=${LC_ALL:-${LC_CTYPE:-${LANG-}}} LC_ALL=
NetBSD setlocale(3) says under RETURN VALUES:
Currently, setlocale() returns NULL and fails to change the locale when
LC_COLLATE is modified independently of other values.
...and under CAVEATS:
LC_COLLATE is unimplemented (but does not make sense for many languages).
Probably this can be due that.
Getting rid of "LC_COLLATE=C" on that local remove that warnings.
Maybe we should conditionalize that for [[ $OSTYPE != *netbsd* ]] so
that such local is not set on NetBSD.
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.