Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
5413-init-Avoid-outputting-non-ASCII-characters...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5413-init-Avoid-outputting-non-ASCII-characters-from-init.patch of Package erlang
From c2d5b70a37ce3596a86acc8c20cbbb813e33742c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Wed, 22 Feb 2023 06:36:30 +0100 Subject: [PATCH] init: Avoid outputting non-ASCII characters from -init_debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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} --- erts/preloaded/ebin/init.beam | Bin 64272 -> 64256 bytes erts/preloaded/src/init.erl | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) 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 @@ -103,7 +103,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_arguments() -> Flags when -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor