Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LC_CTYPE=UTF causes libreadline applications to crash due to invalid locale on non-Ubuntu systems #840

Open
NCommander opened this issue Apr 18, 2024 · 0 comments

Comments

@NCommander
Copy link

cool-retro-term, at least on macOS, sets LC_FTYPE to UTF-8, and no other locale information. This is an invalid locale (it should be unset, or set to 'C'), but it has a rather disastrous interaction with programs compiled against older versions of readline that have NLS enabled

LANGUAGE=''
LC_CTYPE=UTF-8

This causes bash on illumos to crash when logging via SSH (omniosorg/omnios-build#3537 (comment)), which took an extended effort to debug and find. The issue is in most versions of libreadline, but has been patched upstream at this point.

Ubuntu has a special script, /etc/profile.d/01-locale-fix.sh which resets the locale to something valid which prevents this issue from cropping up there.

The problem in cool-retro-term is here: https://github.com/Swordfish90/qmltermwidget/blob/63228027e1f97c24abb907550b22ee91836929c5/src/ksession.cpp#L84

On Linux, it should probably just accept whatever LC_* it gets from the login environment as is. That said, setting LC_CTYPE only affects the output of tolower() , toupper() and isalpha(), and a few other functions, and its usually errorous to set it without other locale information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant