[SERVER-6938] Mongo shell should not use CHA escape sequence Created: 05/Sep/12  Updated: 10/May/22

Status: Backlog
Project: Core Server
Component/s: Shell
Affects Version/s: 2.2.0
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: dongde Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Unresolved Votes: 0
Labels: move-sa, platforms-re-triaged
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS:CentoS 5.5 MongoDB version 2.2


Attachments: PNG File SecuretCRT 7.2.5 OSX with Mongo Shell.png     PNG File SecuretCRT 7.2.5 Windows with Mongo Shell 2.2.7 and 2.4.9.png     PNG File SecuretCRT 7.2.5 Windows with Mongo Shell.png    
Issue Links:
Related
Participants:

 Description   

The Cursor Horizontal Absolute escape sequence (ESC [ nnn G) is not an original VT100 escape sequence, so terminal programs with a strict VT100 mode may not interpret it. This can cause repaint glitches, including "echoes" of typed text. It would be better to use only VT100 escape sequences to do cursor positioning in Unix mode.

Original report:
Upgraded from version 1.8.1 to 2.2.0 , mongodb shell will echo the command when press "ENTER" , how can i change the behavior

ex:
> show dbsshow dbs



 Comments   
Comment by Steven Vannelli [ 10/May/22 ]

Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions.

Comment by Victor Hooi [ 12/Jun/14 ]

tl;dr - Seems fine with latest SecureCRT (7.2.5)

I've tested this with SecureCRT 7.2.5 on both OSX 10.9.3 and Windows 8.1.

My TERM was set to "vt100".

I connected to a remote Ubuntu 14.04 x64 box running Mongo 2.6.1.

I wasn't able to reproduce the echoing typed text issue.

I've attached screenshots for both.

Comment by dongde [ 07/Sep/12 ]

I changed emulation type in SecureCRT to vt220 , xterm ,vt100 ... and enabled EMACS, it is still not work .
i downloaded other terminal program - putty , it does not has such behavior , seems mongo shell 2.2 is not compatible with SecureCRT 4.0( the version i used) , but it worked with mongo shell 1.8

Comment by Tad Marshall [ 06/Sep/12 ]

In addition, you might want to enable EMACS mode (in the same dialog) and select "Send escape for meta key" to make keystrokes like Meta-B (Alt+B) work.

Comment by Tad Marshall [ 06/Sep/12 ]

I downloaded SecureCRT for Linux version 7.0.1 and I was able to duplicate your issue.

Changing the emulation type in SecureCRT from VT100 to any of VT220, Linux or Xterm (in Options/Session Options/Terminal/Emulation) made it work properly for me.

It looks like the CHA – Cursor Horizontal Absolute escape sequence (ESC [ <position> G) we are using to position the cursor horizontally on the line is not an original VT100 sequence, but is a later addition. We didn't notice this because it works with Gnome Terminal, aterm, rxvt, konsole, yaquake and xterm. If you set SecureCRT to VT220, Linux or Xterm emulation then it should work with SecureCRT as well.

Comment by Tad Marshall [ 06/Sep/12 ]

We have had reports of issues with SecureCRT and apparently it can be fixed by changing the emulation setting, though I'm not sure why a setting labeled "VT100" would not work. See SERVER-3826 for one example. I'll try testing with SecureCRT and see if there is something that can be fixed on our side.

The output of your keyboard debugging test is the same as on my machine, so apparently the escape sequence we are using for cursor positioning is not working in SecureCRT with the settings you are using.

Comment by dongde [ 06/Sep/12 ]

My terminal program is secureCRT .

Comment by dongde [ 06/Sep/12 ]

Dear Tad ,

Thanks for response the question.

I am running bash shell with terminal type VT100 .

and following your instructions and shows below message :
>
Entering keyboard debugging mode (on ctrl-^), press ctrl-C to exit this mode
115 x73 ('s')
104 x68 ('h')
111 x6F ('o')
119 x77 ('w')
32 x20 (space)
100 x64 ('d')
98 x62 ('b')
115 x73 ('s')
13 x0D (^M)
3 x03 (^C)
Leaving keyboard debugging mode (on ctrl-C)

Comment by Tad Marshall [ 05/Sep/12 ]

What terminal program are you using? Is it configured to be in a VT100-compatible mode?

Are you running the bash shell, or something else (e.g. EMACS command window)?

What do you get for "echo $TERM" at the (bash or other) shell prompt?

At the mongo shell prompt, can you press ctrl-^ (the Ctrl key and 6) and type your command, ending with Enter, then press ctrl-C and paste the result into this ticket? This puts the keyboard into a debugging mode that shows what keystrokes we are seeing; ctrl-C will exit the mode.

Generated at Thu Feb 08 03:13:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.