Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Nov 2022 16:19:47 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 267528] bash crashes with segfault if LC_CTYPE or LC_ALL not set
Message-ID:  <bug-267528-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267528

            Bug ID: 267528
           Summary: bash crashes with segfault if LC_CTYPE or LC_ALL not
                    set
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: ralph@lr.los-gatos.ca.us

Applies to bash 5.2_3. Problem did not exist on 5.1_16. Problem observed on
FreeBSD 12.3-RELEASE-p6, on both architectures i386 and amd64. Problem star=
ted
after upgrading bash. Using packages, not built from ports.

Bash crashes with a segfault, unless the variable LC_CTYPE or LC_ALL are se=
t to
a valid value (I have tried C, C.UTF-8, and en_US.UTF-8), before any "other"
commands are executed. So it works if you start it as "LC_CTPYE=3DC
/usr/local/bin/bash", or it works if you have "LC_CTPYE=3DC" as the first
executed line of .bashrc (and exactly equivalent with LC_ALL). By "first
executed line" I mean the first first non-comment line.

If LC_CTYPE is set to a syntactically valid but non-existing locale (for
example "C.XXX-8" instead of UTF), and that setting is not an environment
variable set when bash starts, but happens in the first line of .bashrc, th=
en
bash first prints an error message (and then segfaults):
bash: warning: setlocale: LC_CTYPE: cannot change locale (C.XXX-8): Invalid
argument

Temporary workaround: Add LC_CTYPE=3D... (something valid) as the first lin=
e of
.bashrc for all users.=20

What's the impact of this? If a system has users who use bash as their login
shell, they become locked out. And in a fashion that's hard to debug, since=
 the
only indication that is left is an error message in /var/log/auth.log.

More discussion can be found in the forum, with some traces that _martin
collected, can be found in here:
https://forums.freebsd.org/threads/bash-is-broken-after-upgrade-to-5-2_3.86=
938/

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-267528-7788>