Priority: Minor - P4
Resolution: Won't Fix
Affects Version/s: None
Fix Version/s: None
In switching from readline to linenoise in version 1.9, a lot of functionality was given up and some bugs were introduced. linenoise is workable, maintainable code and can be improved over time. But it doesn't do what readline did and probably never will.
For users who are heavy users of readline-style functionality such as history search, kill rings and support for non-VT100-style terminals, it can be a disappointment to lose those features in an upgrade of MongoDB.
We could load libreadline.so or let the user force a specific version.
Internally, we would let shell/dbshell.cpp deal with whether the user asked us to do this, and then hand the issue off to linenoise.
char * errorString = linenoiseUseReadline(char * readlinePath); // readlinePath == 0 means "figure it out yourself"
If errorString != 0 we could display it. Regardless of what linenoise returned, dbshell would call the same linenoise functions and linenoise would either call readline or handle everything itself. This puts the burden of supporting readline on linenoise and keeps it out the the client's areas of concern.
At one level of stretch, we could do this automatically by default, and make the user ask us not to do it if they really didn't want it.
At level two of stretch, we could do this for Windows, using either Cygwin or "Readline for Windows" (http://gnuwin32.sourceforge.net/packages/readline.htm). Readline for Windows exports 551 symbols and looks like a complete version with proper Win32 support.
.\mongo --use-readline="C:\Program Files (x86)\GnuWin32\bin\readline5.dll"
This isn't so much a feature as a workaround. Anyone attached to readline can stay in their comfort zone when upgrading MongoDB. Anyone having issues with SecureCRT or any other terminal program can try using readline and see if the problem goes away. Tech supporters get another option to suggest, users get more stuff to configure if they feel like it (but normal documented default behavior if they don't) and power users feel their power. A little coding to make this work, and everybody wins.
The reason this is possible is because the interfaces and usage of them is mostly the same between readline and linenoise. linenoise was written to be a (much) smaller replacement for readline and the calls and callbacks are pretty much the same. readline is old, crufty code written in Unix-oriented C using pre-ANSI C function declarations and tons of global variables, but it does an amazing amount of stuff and it is battle-tested, stable and standard. bash calls it. linenoise is newer (2010) and fits comfortably into a single .cpp file. Our (changed) copy works on Windows and VT100-style terminals (i.e. most Unix-like systems) and is a fine solution for many people. Opening up the readline option for people who need it would just increase the number of addressable users and increase the support options for people with issues.