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

std::rl is unsafe #3921

Closed
brson opened this issue Nov 5, 2012 · 4 comments
Closed

std::rl is unsafe #3921

brson opened this issue Nov 5, 2012 · 4 comments

Comments

@brson
Copy link
Contributor

brson commented Nov 5, 2012

linenoise uses global state without mutexes. My preferred fix is #3915. For now I will mark the interface unsafe.

@brson
Copy link
Contributor Author

brson commented Nov 5, 2012

Also, the completion callbacks need to be cleaned up at some point. This API should probably be attached to some ReadlineContext that tries to pretend like it's not a global API, cleans up the Rust pointers on destruction, and tries to be defensive about multiple clients trying to use the API concurrently.

@graydon
Copy link
Contributor

graydon commented May 8, 2013

blocked on #553 most likely

@emberian
Copy link
Member

#553 and #3915 are both fixed with static mut.

@huonw
Copy link
Member

huonw commented Sep 10, 2013

Triage: hopefully fixed when #9096 lands.

bors added a commit that referenced this issue Sep 12, 2013
- Wrap calls into linenoise in a mutex so that the functions don't have to be `unsafe` any more (fixes #3921)
- Stop leaking every line that linenoise reads.
- Handle the situation of `rl::complete(some_function); do spawn { rl::read(""); }` which would crash (`fail!` that turned into an abort, possibly due to failing with the lock locked) when the user attempted to tab-complete anything.
- Add a test for the various functions; it has to be run by hand to verify anything works, but it won't bitrot.
@huonw huonw closed this as completed in 21ce41d Sep 12, 2013
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

Successfully merging a pull request may close this issue.

4 participants