Comments (6)
Judging by the issue you've opened with webstorm, and that this doesn't occur in other terminals, I suspect it's just a webstorm problem. I haven't heard of anyone else having problems with Chinese input methods
from atuin.
The panic is reproducible with the following command.
$ a='\x80' atuin search
thread 'main' panicked at library/std/src/env.rs:171:83:
called `Result::unwrap()` on an `Err` value: "\x80"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This is probably related: https://doc.rust-lang.org/std/env/fn.vars.html#panics
This means that any Rust programs using std.env.vars
somewhere will panic if any environment variables (including the ones that the program doesn't use) contain binary data or a string in a different encoding.
This implies that when a user switches the locale by setting e.g. LANG
, LC_CTYPE
, or LC_ALL
, all the environment variables need to be cleared for Rust programs to work. This is a strange requirement by Rust.
from atuin.
Hm that doesn't reproduce the issue for me 🤔
Is there a specific terminal or setup you're using?
from atuin.
- I tried release version of v18.2.0 and both the debug/release builds of commit eebfd04. In all the binaries I could test, the problem reproduces. However, the current
main
branch doesn't compile in my host, so I haven't tested the latestmain
branch. - I don't think the terminal is related when using the above command (because the part
a=$'\x80'
mimics the terminal's behavior in the report), but I tried different terminals. The panic reproduces with all the terminals I quickly tried, including GNU Screen, Terminology, and Mintty, Alacritty, and Kitty. - The panic reproduces with all of the cases
LC_CTYPE='en_US.UTF-8'
,LC_CTYPE='ja_JP.UTF-8'
,LC_CTYPE='C.UTF-8'
, andLC_CTYPE='C'
- The panic also reproduces with the default
.config/atuin/config.toml
(i.e., the one generated when it is missing). - The panic reproduces also with an empty command history.
- I also tried it with Zsh, Bash/bash-preexec, and Bash/ble.sh. In all the cases, the problem reproduces.
from atuin.
Ah I see, got it. Thanks
This implies that when a user switches the locale by setting e.g. LANG, LC_CTYPE, or LC_ALL, all the environment variables need to be cleared for Rust programs to work. This is a strange requirement by Rust.
It's actually just the usage of std::env::vars, which uses a String. These require utf8 encoding.
std::env::vars_os
uses an OsString, which does not. We could probably wrap this and then only use the values internally that are valid utf-8, and ignore the rest rather than panicking
Regardless of this, I'm still curious as to why this only happens with webstorm (for OP)
This problem occurs when typing Chinese content with Chinese input methods, and only occurs in the webstorm terminal.
from atuin.
Regardless of this, I'm still curious as to why this only happens with webstorm (for OP)
This problem occurs when typing Chinese content with Chinese input methods, and only occurs in the webstorm terminal.
This is just my guess, but I think the WebStorm terminal sends the user input with an encoding different from UTF-8. Then, the shell receives the data and stores it in an environment variable. This behavior might be caused by just the user's configuration for the terminal encoding, or it might be the WebStorm terminal's issue with handling the data from the system's input method.
So, I think the reported problem could be solved if the WebStorm terminal is properly configured or fixed. Nevertheless, I see it as also a problem that crate config
scans the environment variables that the program doesn't even use and panics with a non-UTF-8 environment variable unused by the program. Atuin shouldn't be affected by random environment variables that it doesn't use.
For the non-UTF-8 environment variables that Atuin actually uses, I'm not sure about the desired behavior. It may just ignore the environment variable or print a warning message.
from atuin.
Related Issues (20)
- Expand on the set of GitHub tokens that Atuin will consider secrets
- [Bug]: Scroll position is not restored when using `inline_height` HOT 1
- [Bug]: Nushell integration adds a significantly delay before each prompt
- Hide `host` filter mode if there's only one
- [Bug]: Timezone not change in config HOT 1
- Feature Request: Set terminal title when interactive mode is launched via shell hooks
- [Bug]: Right Alt 2 doesn't type @ HOT 2
- Problems while installing and using. HOT 2
- [Bug]: History stopped recording HOT 7
- Trigger sync on daemon stop HOT 2
- [Bug]: Install script putting env sourcing in .bash_profile instead of .bashrc HOT 4
- [Bug]: UI not working properly when inside a GNU screen session HOT 1
- [feature request] auto execute `atuin sync --force` after `atuin login` HOT 1
- [Bug]: atuin command not found when a new shell is opened HOT 5
- Prost and tonic updates HOT 5
- [Bug]: history not synced between two Macs 🤔 HOT 2
- [Bug]: Ctrl-C (or any ctrl+key) does not work after invoking atuin with Ctrl-R HOT 21
- [Bug]: History not synced across two machines HOT 3
- Systemd file not working
- Error running atuin daemon
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atuin.