[SERVER-27560] Ctrl-c in shell password input leaves terminal in non-echo mode Created: 03/Jan/17 Updated: 06/Dec/22 Resolved: 03/Dec/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Kevin Pulo | Assignee: | Backlog - Server Tooling and Methods (STM) (Inactive) |
| Resolution: | Won't Fix | Votes: | 2 |
| Labels: | move-stm | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
POSIX |
||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Server Tooling & Methods
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Steps To Reproduce: |
|
||||||||||||
| Participants: | |||||||||||||
| Description |
|
If the user realises that they have accidentally provided the wrong username when using the shell with plain --password/-p to connect and prompt for the password, a very natural reaction is to hit Ctrl-C to cancel the connection attempt, so that the user can re-run the shell with the correct username. However, if Ctrl-C is typed while the shell is prompting for a password, the terminal is left in non-echo mode, which messes up the display from that point onwards. The expected behaviour is for the terminal mode to be normal whenever the shell exits, including if it is killed while prompting for a password. The workaround is the normal one in this situation, ie. the user must (blindly) type stty echo<enter> or stty sane<enter> or reset<enter>. |
| Comments |
| Comment by Brooke Miller [ 03/Dec/21 ] |
|
We've deprecated the mongo shell in favor of the new mongosh. Unfortunately, we aren't able to pursue improvements to the deprecated shell except in extreme cases, such as critical security fixes. Please start making use of mongosh and let us know if it works for you in this case. |
| Comment by Joanna Cheng [ 02/Oct/20 ] |
|
Still repros for me with mongo shell 4.0.18, ContOS 7.8.2003 |
| Comment by Kevin Pulo [ 18/May/20 ] |
|
Still repros for me in Ubuntu 18.04, both old versions like 3.4.24, and 4.2.6 and current master. I can imagine that some setups (eg. some *nix shells, or some *nix shell user configs) might forcibly reset the terminal's echo state after running a program, or before printing the shell prompt. Similarly, when I send SIGQUIT (Ctrl-\ on my system) instead of SIGINT (Ctrl-C), the mongo shell throws a backtrace and the terminal is fine afterwards. oleg.pudeyev does one of these situations correspond to your testing? |
| Comment by Oleg Pudeyev (Inactive) [ 15/May/20 ] |
|
I could not reproduce the issue just now on Debian. Tried 2.6.12 and 3.4.24. Perhaps something changed in the terminal programs or the situation is system-dependent. |
| Comment by Kevin Pulo [ 13/Jun/19 ] |
|
The passwordPrompt() function introduced in |
| Comment by Joanna Cheng [ 03/Jan/17 ] |
|
Reproduced in OSX 10.11.6 in the native Terminal |