forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…5954) * Remove `jl_getch()` to fix race condition in `getpass()` We accidentally introduced a race condition in `getpass()` by having `jl_getch()` toggle terminal modes for each keystroke. Not only is this slower and wasteful, it allows the kernel to receive keystrokes within a TTY in canonical mode (where it replaces certain characters [0]) and then reads from the kernel buffer in non-canonical mode. This results in us reading a `0x00` when we expected a `0x04` in certain cases on CI, which breaks some of our tests. The fix is to switch the TTY into raw mode once, before we ever print the password prompt, which closes the race condition. To do this, we moved more code from C to Julia, and removed the `jl_getch()` export, instead providing `jl_termios_size()`. [0] https://github.com/torvalds/linux/blob/e35e5b6f695d241ffb1d223207da58a1fbcdff4b/drivers/tty/n_tty.c#L1318 * Update base/util.jl Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Apply suggestions from code review Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Apply suggestions from code review Co-authored-by: Jameson Nash <vtjnash@gmail.com> Co-authored-by: Jameson Nash <vtjnash@gmail.com>
- Loading branch information
1 parent
5ca6e64
commit 5d4735b
Showing
4 changed files
with
78 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters