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
UTF-8 locales don't work on DragonFly BSD, FreeBSD 11, 12 #3050
Comments
Which key are you pressing? Backspace? If that is true, please run Future fish versions will make this somewhat easier with a small helper program called "fish_key_reader". What is your $TERM set to? "xterm"? |
the key is Backspace. |
The label on the key doesn't tell us what sequence of characters it sends. Can you install fish from source pulled from the git repository? If you can then We would prefer not to login to your system both for liability reasons and because we don't read chinese so |
./fish_key_reader bind -k backspace echo $TERM |
Okay, that is your problem. It should say something like
I don't see how this could have anything to do with setting the LANG variable. You have somehow overridden the default key bindings. I would search your ~/.config/fish/** files for mentions of the word "bind". Also, are you using any plugin managers (e.g., fisherman or oh-my-fish) or have you installed any other third-party scripts that might be relevant to this problem? |
OK.
under fish-2.2.0
but under fish-2.3.0 ,the command bind output:
|
How did you install fish 2.3.0? It looks like you are running a fish binary that cannot find its user space scripts. |
from source
|
Okay, that looks reasonable. What do the following commands output:
Is there a fish_default_key_bindings.fish in one of the function path directories (usually the last one listed)? I'm curious what |
when I delete .config/fish/config.fish,everything runs well.
when I delete .config/fish/config.fish or comment all lines in /usr/local/etc/fish/config.fish ,the outputs are:
the file |
It seems fish never sets the keybindings. This is either because Since it seems to be triggered by setting $LANG, it points to an encoding issue. All your config files and the fishd file might be nice in a pristine form since I'm not sure if github helpfully tries to fix the encoding. Also, what is your $LANG value if you don't set it in config.fish? (It should be ASCII-compatible, since otherwise I don't think we could even read our own files, but you never know) |
I added
Then attach the typescript file to this issue. |
|
What the hell? You're saying that
Is DragonFly a reference to https://www.dragonflybsd.org/? I wonder if this text on that web page, "a new locale system", is relevant. Did you build fish from git head on that system? If not where did the fish binary come from? What happens if you instead |
yes, https://www.dragonflybsd.org/ is the project home page.
only set LANG C can make
|
on an other DF 4.4 box
fish-2.2.0 runs OK. |
Okay, there is clearly an incompatibility between fish and the DragonFly wide char functions or a bug in the latter. Do you have access to a DragonFly 4.3 system that you can build and test fish on? It would b nice if we could start by confirming it's the changes introduced to the DragonFly 4.4 locale support that is the key change. |
I test the latest fish on a 4.2-RELEASE DragonFly box,everything runs ok.
|
Okay, please talk to the DragonFly maintainers. I'm not saying that the fault lies with their code. But they are more likely to have an explanation why functions like |
I can reproduce this on DragonFly BSD 4.5-DEVELOPMENT as well, with any UTF-8 locale (e.g. |
@krader1961
|
I was going to suggest
But that doesn't fail. Running all the tests via I installed DragonFly 4.4.3 and built and installed fish from git head. Starting fish with
Not surprisingly I may or may not spend more time debugging this. I encourage you to talk to the DragonFly maintainers since they are likely to be able to provide insight into this issue. |
I have a pretty minimal testcase with |
I would be glad to test any patch. |
@faho, Yes, I was just debugging that alias function failure and came to the same conclusion. Whether that accounts for all of these BSD symptoms or not it seems like a good place to dig deeper since double-quoted strings involve one of our internal tokens, VARIABLE_EXPAND_SINGLE, that is in the unicode reserved char range. Also, I added debug statements and all of the |
In fact, you can reproduce the var expansion inside double-quoted string problem quite easily with a UTF-8 locale on BSD:
Definitely worth digging deeper into what's going on when terminating a var reference with a double-quote. All of the above examples work fine with LC_ALL=C. |
I was wrong when I said a few hours ago that So it seems as if we're going to have to implement our own wrappers around those functions to get correct behavior regardless of the platform. I need to think a bit about how to do that with the minimum amount of additional code and confusing layers of abstraction. |
I've opened this FreeBSD bug. We'll still need to workaround this broken implementation. |
We've already established the pattern that fish code should call P.S., I'm inclined to classify this issue as an "enhancement" rather than a "bug" because we're talking about enhancing fish to work around a bug in one of the platforms we support. Yes? No? Who cares? 😄 P.P.S., I've verified that overriding the platform provided |
My preferred way to handle this would be to check the behavior at configure-time, and override the functions if and only if they are incompatible in this regard. |
I'm not going to base overriding the platform functions on autoconf tests. First, we've seen instances of distros which have correct (or incorrect) behavior in one release and then flip the behavior in a subsequent release. A binary built for FreeBSD 10, for example, should still work correctly on FreeBSD 12. Basing our behavior on an autoconf test doesn't handle that. Second, the tests in question are extremely cheap even if we wrap them to ensure correct behavior and the calls to the affected functions are not in critical performance loops. Third, we need one of the helper functions this change will introduce to ensure we don't allow users to inject our magic internal use only code points (which is on my TODO list) into our internal state. |
Also, for the record when I wrote the following statement in an earlier comment I had the two distros reversed:
According the the Unicode FAQ code points in the private use areas are intended to be classified as having an associated glyph (i.e., |
It'd seem to me an autoconf test checking the result of iswalnum() on one of these values would work. |
FreeBSD binary packages from ports will not be built against a different libc than the target - this forms the basis for how all our configure-time tests work. |
As committed this will be overriding the system-provided function unnecessarily on Linux and OS X as well, @krader1961. |
Fish is built and dynamically linked against a shared libc on FreeBSD:
Are you saying with 100% certainty that if the behavior of the locale subsystem changes the libc.so version number will change? I have neither the time nor the inclination to explore that question. I'd rather be conservative given that my fix will not noticeably affect the behavior or performance of fish. |
"not our problem". |
Of course it's our problem. It's the reason we have |
The bug is in the localedef tool that generates the ctype files, and it originated with Illumos. Fixed on DF here: |
@jrmarino: Thanks for the info! Do you know when this'll make it into the various OSs? Is DFs change already getting to users? |
Fixed on FreeBSD as well https://svnweb.freebsd.org/base?view=revision&revision=306782 |
Thank you very much bapt! I just upgraded to FreeBSD 11.0-RELEASE-p1 and well, this is seriously annoying. Do you know if or when the patch will be integrated to FreeBSD 11.0-RELEASE? |
Note that we work around this bug in fish built from git head. If you're still having problems with fish from git head on BSD let us know. The workaround is not in fish 2.3.1 or any earlier release but will be in the upcoming 2.4.0 release. |
The change is rather self-contained - should be easy to backport for any maintainers out there. |
Already in code review. |
Great. |
@shanavar I will merge after 1 month because the change is rather intrusive and I want to make sure there is no side effects, once this is validated I will request an errata for 11.0-RELEASE, meaning you can expect it in around a month+ |
Compiling Fish from git works for me on FreeBSD 11.0-RELEASE-p1:
Then add |
So I wasn't the only one with these problems. Thank you all for correcting, this was driving me mad. |
when put a line like :
set LANG zh_CN.UTF-8
to .config/fish/config.fish
then can't delete any character if command is wrong.
for example:
cate
I want to delete 'e' for command 'cat'
but can't delete any character
under 2.2.0 is fine.
Fish version: fish, version 2.3.0
Operating system: DragonFly testdf.com 4.4-RELEASE DragonFly v4.4.1.18.gc5db8-RELEASE #0: Thu Jan 28 15:02:10 CST 2016 lhm@lhmtestdf.com:/usr/obj/usr/src/sys/lhmwzy x86_64
Terminal or terminal emulator: xterm
The text was updated successfully, but these errors were encountered: