Disable keyboard input in "split" mode#51
Conversation
Keyboard input does not seem useful in split mode, as the output is probably meant to be parsed by another program. Users can press ^C anyway if they want to interrupt mtr. It was helplessly broken anyway: no key press was actually taken into account (see bug traviscross#30 on Github), *except* the "Enter" key, which would cause an infinite loop by calling select() repeatedly.
|
Btw, it might seem quite unhelpful to remove a feature just because I don't like it. This actually caused me quite a lot of trouble: when using So, this feature causes |
|
It may help to understand what "split mode" is intended to do. Although mtr security issues are "rare and far between", the situation is still that mtr is linked against several large libraries. Any C++ code in there will have initializers that are called BEFORE main is started. Main will allocate the sockets and drop root privileges. Any bugs in the (library) startup code are a possible security bug. So the intention of "split" mode is to split mtr into a core that does the ping-ing, and several helper modules that
The "split mode" is the first attempt at making the old mtr behave as the "pinging" module. The intention is not to loose functionality while moving to the new architecture. And "display-control" modules are currently able to signal "please reset the aggregation" or "please move to a new target". So while "keyboard" input is not the intention of "split mode", monitoring the input for control messages IS. |
|
Ah, right, thanks for the precision :) In this case, it will indeed be a better idea to fix input handling, especially the infinite loop. I have absolutely no idea what's going wrong, but it seems related to ncurses. |
|
Probably you need to have the terminal initialized (initscr()/newterm()) before called ncurses getch() function. |
|
zorun, thank you this was driving me crazy. bash script I was writing would work in any other mode than --split, but I wanted the --split output format. I wasn't getting a random infinite loop, it'd do it every execution. |
Keyboard input does not seem useful in split mode, as the output is
probably meant to be parsed by another program. Users can press ^C anyway
if they want to interrupt mtr.
It was helplessly broken anyway: no key press was actually taken into
account (see bug #30 on Github), except the "Enter" key, which would
cause an infinite loop by calling select() repeatedly.