SSH-daemon freezing while call io:getopts() and io:setopts()
Alexander Demidenko <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.bugs,gmane.comp.lang.erlang.patches |
|---|---|
| Message-ID | <CAN0YpQ9zK+142HBPp4jo-kV2Q8j7Keoasg6UJPRG0pN7aUesVQ@mail.gmail.com> |
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.
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
ssh_delay_test.tar.gz
(application/x-gzip, 3.2 KB) - not displayed