File 0465-ssh-Better-logging-resilence-to-CRLF-from-shell.patch of Package erlang

From 0e80eaaed2146aab1f0448d284e86a07b51f1be5 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Thu, 4 Mar 2021 14:26:29 +0100
Subject: [PATCH] ssh: Better logging + resilence to CRLF from shell

---
 lib/ssh/test/ssh_sup_SUITE.erl | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/ssh/test/ssh_sup_SUITE.erl b/lib/ssh/test/ssh_sup_SUITE.erl
index dc98325c9f..9e0e10c3bb 100644
--- a/lib/ssh/test/ssh_sup_SUITE.erl
+++ b/lib/ssh/test/ssh_sup_SUITE.erl
@@ -318,7 +318,8 @@ shell_channel_tree(Config) ->
     ct:log("GroupPid = ~p, ShellPid = ~p",[GroupPid,ShellPid]),
 
     receive
-        {ssh_cm,ConnectionRef, {data, ChannelId0, 0, <<"TimeoutShell started!\r\n">>}} ->
+        {ssh_cm,ConnectionRef, {data, ChannelId0, 0, <<"TimeoutShell started!",Rest/binary>>}} ->
+            ct:log("TimeoutShell started. Rest = ~p", [Rest]),
             receive
                 %%---- wait for the subsystem to terminate
                 {ssh_cm,ConnectionRef,{closed,ChannelId0}} ->
@@ -340,17 +341,18 @@ shell_channel_tree(Config) ->
                             ct:fail("Sup tree changed!")
                     end
             after 10000 ->
+                    ct:log("~p:~p  Flush unexpected: ~p", [?MODULE,?LINE,flush_rest()]),
                     ssh:close(ConnectionRef),
                     ssh:stop_daemon(Daemon),
-                    ct:fail("CLI Timeout")
+                    ct:fail("CLI Timeout 1")
             end
     after 10000 ->
+            ct:log("~p:~p  Flush unexpected: ~p", [?MODULE,?LINE,flush_rest()]),
             ssh:close(ConnectionRef),
             ssh:stop_daemon(Daemon),
-            ct:fail("CLI Timeout")
+            ct:fail("CLI Timeout 2")
     end.
 
-
 chk_empty_con_daemon(Daemon) ->
     ?wait_match([{_,SubSysSup, supervisor,[ssh_subsystem_sup]},
 		 {{ssh_acceptor_sup,_,_,_}, AccSup, supervisor,[ssh_acceptor_sup]}],
@@ -490,3 +492,10 @@ acceptor_pid(DaemonPid) ->
     after 2000 -> timeout
     end.
 
+%%%----------------------------------------------------------------
+flush_rest() -> lists:reverse(flush_rest([])).
+
+flush_rest(Acc) ->
+    receive Any -> [Any|Acc]
+    after 0 -> Acc
+    end.
-- 
2.26.2

openSUSE Build Service is sponsored by