Swordfish90/cool-retro-term

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

NCommander opened this issue · 0 comments

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.