[erlang-bugs] SSH-daemon freezing while call io:getopts() and io:setopts()
Alexander Demidenko
alex.demidenko@REDACTED
Thu Nov 21 02:41:43 CET 2013
Hello, friends.
I have a trouble with using shell in the ssh-daemon, when I call the
function io:getopts() and io:setopts([{echo, false}, {encoding, latin1}]).
Tested by Erlang 16B02, ssh 2.1.8 and R15B02, ssh 2.1.1
How can i see, in the ssh_cli.erl module, handle_msg metod no function for
processing param ({Group, set_unicode_state, Arg}, State) and ({Group,
get_unicode_state}, State).
My patch for fixing:
--- ssh-2.1.1/src/ssh_cli.erl 2013-10-26 14:25:26.000000000
+++ ssh-2.1.2/src/ssh_cli.erl 2013-10-26 14:18:18.000000000
@@ -159,12 +159,20 @@
%%--------------------------------------------------------------------
handle_msg({ssh_channel_up, ChannelId, ConnectionManager},
#state{channel = ChannelId,
cm = ConnectionManager} = State) ->
{ok, State};
+handle_msg({Group, set_unicode_state, _Arg}, State) ->
+ Group ! {self(), set_unicode_state, false},
+ {ok, State};
+
+handle_msg({Group, get_unicode_state}, State) ->
+ Group ! {self(), get_unicode_state, false},
+ {ok, State};
+
handle_msg({Group, Req}, #state{group = Group, buf = Buf, pty = Pty,
cm = ConnectionManager,
channel = ChannelId} = State) ->
{Chars, NewBuf} = io_request(Req, Buf, Pty),
write_chars(ConnectionManager, ChannelId, Chars),
{ok, State#state{buf = NewBuf}};
Also I attached simple sample, where you can see this problem. To run it,
compile ssh_shell.erl and ssh_manager.erl and invoke
"ssh_manager:start_link()" method to run ssh-daemon. (you need generate
personal keys for used it) Then run ssh-client on terminal to localhost on
port 7777, after entering the password “test”, enter the command "echo_on"
or "echo_off".
You can see that there is a delay when calling functions io:getopts() and
io:setopts([{echo, false}, {encoding, latin1}]).
--
---------------------------------------------
With best regards,
Alexander.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20131121/37a2bee6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ssh_delay_test.tar.gz
Type: application/x-gzip
Size: 3311 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20131121/37a2bee6/attachment.bin>
More information about the erlang-bugs
mailing list