-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
archlinux: Unhandled exception 'Invalid locale for LC_CTYPE' #912
Comments
Thanks for the report, this is similar to #868 which has stymied us. Thread here: Can you run Oil is trying to use https://github.com/oilshell/oil/blob/master/native/libc.c#L25 That was motivated by Debian! We used to use Possible solution: try BOTH, but that seems hackish... It would be nice to get to the bottom of this |
OK I added some comments in What I think is going on: UTF-8 support in libc is NOT required by POSIX? And some systems do it differently? They use either C.UTF-8 or en_US.UTF-8. Possible solution:
I'm not sure if that is the best behavior, but the warning will at least elicit complaints from people and we can see if there is a different solution for them. It's better than the crash. The other solution is to try both, but it seems weird to try @abathur also hit the dev build version of this |
osh$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8" btw. when i set the values in the |
Oh also Actually here's some better logic: if the current locale already contains But if it doesn't, AND we can't set it to
|
osh$ locale -a
C
en_US.utf8
POSIX |
ubuntu container: root@dbc8e72c24b0:/# locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
root@dbc8e72c24b0:/# locale -a
C
C.UTF-8
POSIX |
OK thanks, that's what I suspected. I think the logic I outlined will work on both Arch and Debian then. I have no idea why the C locale scheme is so weird. The whole thing is fundamentally broken in a networked world, because you can obviously have filenames encoded differently on a single file system, but the encoding is a global variable! Same issue if you pipe "curl" to "sh" or something -- the global is fundamentally wrong; it depends on what's at the other end of the pipe |
Actually I realized that a core reason for this bug is CPython, which has its own scheme for unicode ... Hopefully there is some way to prevent the Python interpreter from calling (This won't be a problem with
Reading over https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING |
Gah, it seems impossible to avoid Python calling https://github.com/oilshell/oil/blob/master/Python-2.7.13/Python/bltinmodule.c#L25 This is lame .. ! global variables everywhere, and libraries fighting over them |
CPython DOES call it, so there's a workaround in the dev build only: libc.cpython_reset_locale(). - Remove explicit setlocale() calls from native/libc.c - Remove setlocale() calls when OVM_MAIN is defined - Add the cpython_reset_locale() hack for the remaining case - Refactor OVM_MAIN check into into pyutil.IsAppBundle() Spec tests: - spec/glob: Test started passing! Woohoo we're more consistent. - spec/oil-regex: Documented that we need LANG=C support. This is issue #529. Addresses issue #912.
OK I did a big overhaul of this. I worked around the REAL Issue, which is that CPython calls Conceptually, Oil isn't tied to CPython, so that side effect is wrong. Now Oil never calls Related to #529 |
Thanks for the report! |
Looking good. Encountered a different error on a specific completion (some drawing errors), but generally it works. |
This is the main drawing bug I know of, and is somewhat fundamental: (Oil tries to do better than bash, but it still uses GNU readline. I think GNU readline can't really handle it.) If you notice anything that doesn't seem related to that, let me know We might have to go back to bash-style completion UI, and then defer fancier UI to others #738 |
Ah yes, i forgot to start it with |
OK great, yeah unfortunately we might have to make that the default :-/ I think the drawing stuff is fundamental due to using readline |
Error occurs on
archlinux
/manjaro
but works onubuntu
.The text was updated successfully, but these errors were encountered: