summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2023-02-22 06:36:30 +0100
committerBjörn Gustavsson <bjorn@erlang.org>2023-02-22 07:49:01 +0100
commitc2d5b70a37ce3596a86acc8c20cbbb813e33742c (patch)
tree37a2cc79654795007bba630d39f3b3de46d4c177
parentbe7109f43beeeea199ae74a42393927d013f75d9 (diff)
downloaderlang-c2d5b70a37ce3596a86acc8c20cbbb813e33742c.tar.gz
init: Avoid outputting non-ASCII characters from -init_debug
ba18068dc28693 (#6685) added printing of timing for the `-init_debug` option: {start,heart} {'done_in_µs',10} With that change, the test case `peer_SUITE:init_debug/1` started to fail sporadically. That test case tries to start a peer node with option `-init_debug` using the connection type `standard_io`: {ok, Peer, _Node} = peer:start_link(#{name => peer:random_name(?FUNCTION_NAME), shutdown => 1000, connection => standard_io, args => ["-init_debug"]}), The test case would fail when the two bytes that comprise the `µ` character were split up into two separate IO requests. We could update the `peer` module so that it would do buffering and re-combine split UTF-8 sequences. That would fix the failing test case. However, introducing re-combining is not sufficient to make it safe to print arbitrary non-ASCII characters, because of an undocumented restriction mentioned in a comment for the `standard_io` connection type: %% Characters in range of 192-255 are reserved for control sequences, %% see encode_port_data for details. If peer node attempts to print %% characters in this range, an controlling process on the origin %% node may terminate with an error (because CRC check will fail). (The actual restriction is actually slightly less severe than the comment implies, which is why `µ` would work after re-combining but others characters such as `ö` would not. Note that the other connection modes don't have this restriction, but they are not able to catch the output from `-init_debug`.) Since printing of arbitrary non-ASCII characters cannot be made safe for the `standard_io` connection mode, change the printout of timing information to only use ASCII characters: {start,heart} {done_in_microseconds,10}
-rw-r--r--erts/preloaded/ebin/init.beambin64272 -> 64256 bytes
-rw-r--r--erts/preloaded/src/init.erl2
2 files changed, 1 insertions, 1 deletions
diff --git a/erts/preloaded/ebin/init.beam b/erts/preloaded/ebin/init.beam
index 0e7296924f..d2ea6b7025 100644
--- a/erts/preloaded/ebin/init.beam
+++ b/erts/preloaded/ebin/init.beam
Binary files differ
diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl
index 45ca42778d..7933cfaa34 100644
--- a/erts/preloaded/src/init.erl
+++ b/erts/preloaded/src/init.erl
@@ -106,7 +106,7 @@ debug(_, T, Fun) ->
Val = Fun(),
T2 = erlang:monotonic_time(),
Time = erlang:convert_time_unit(T2 - T1, native, microsecond),
- erlang:display({'done_in_μs', Time}),
+ erlang:display({done_in_microseconds, Time}),
Val.
-spec get_configfd(integer()) -> none | term().