aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-08-17 12:02:58 +0200
committerLukas Larsson <[email protected]>2016-08-17 12:02:58 +0200
commit7b1cda1f97cd3ec91e7111b22aeffa3b5a6812f1 (patch)
treec494e75e3c54bc8172277df45b6c2cec31c884d5 /lib/kernel
parentb412ea7ed2513400bcaa63581ae68219e7cce2d6 (diff)
parent71894a879d6254693791585246ce340dd7414b82 (diff)
downloadotp-7b1cda1f97cd3ec91e7111b22aeffa3b5a6812f1.tar.gz
otp-7b1cda1f97cd3ec91e7111b22aeffa3b5a6812f1.tar.bz2
otp-7b1cda1f97cd3ec91e7111b22aeffa3b5a6812f1.zip
Merge branch 'maint-19' into maint
* maint-19: Updated OTP version Prepare release erts: Make sure to flush potential exit message
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/doc/src/notes.xml17
-rw-r--r--lib/kernel/src/os.erl16
-rw-r--r--lib/kernel/test/os_SUITE.erl22
-rw-r--r--lib/kernel/vsn.mk2
4 files changed, 48 insertions, 9 deletions
diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml
index 0e3914b083..3d35f6f57f 100644
--- a/lib/kernel/doc/src/notes.xml
+++ b/lib/kernel/doc/src/notes.xml
@@ -31,6 +31,23 @@
</header>
<p>This document describes the changes made to the Kernel application.</p>
+<section><title>Kernel 5.0.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ When calling os:cmd from a process that has set trap_exit
+ to true an 'EXIT' message would be left in the message
+ queue. This bug was introduced in kernel vsn 5.0.1.</p>
+ <p>
+ Own Id: OTP-13813</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Kernel 5.0.1</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 81b70a7fee..05bbf1069e 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -279,15 +279,11 @@ get_data(Port, MonRef, Eot, Sofar) ->
Last ->
Port ! {self(), close},
flush_until_closed(Port),
+ flush_exit(Port),
iolist_to_binary([Sofar, Last])
end;
{'DOWN', MonRef, _, _ , _} ->
- receive
- {'EXIT', Port, _} ->
- ok
- after 1 -> % force context switch
- ok
- end,
+ flush_exit(Port),
iolist_to_binary(Sofar)
end.
@@ -307,3 +303,11 @@ flush_until_closed(Port) ->
{Port, closed} ->
true
end.
+
+flush_exit(Port) ->
+ receive
+ {'EXIT', Port, _} ->
+ ok
+ after 1 -> % force context switch
+ ok
+ end.
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index 8f3e511941..19ab3713a1 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -25,7 +25,7 @@
-export([space_in_cwd/1, quoting/1, cmd_unicode/1, space_in_name/1, bad_command/1,
find_executable/1, unix_comment_in_command/1, deep_list_command/1,
large_output_command/1, background_command/0, background_command/1,
- perf_counter_api/1]).
+ message_leak/1, perf_counter_api/1]).
-include_lib("common_test/include/ct.hrl").
@@ -36,7 +36,8 @@ suite() ->
all() ->
[space_in_cwd, quoting, cmd_unicode, space_in_name, bad_command,
find_executable, unix_comment_in_command, deep_list_command,
- large_output_command, background_command, perf_counter_api].
+ large_output_command, background_command, message_leak,
+ perf_counter_api].
groups() ->
[].
@@ -284,6 +285,23 @@ background_command(_Config) ->
%% longer then the 5 second timeout
os:cmd("sleep 10&").
+%% Test that message does not leak to the calling process
+message_leak(_Config) ->
+ process_flag(trap_exit, true),
+
+ os:cmd("echo hello"),
+ [] = receive_all(),
+
+ case os:type() of
+ {unix, _} ->
+ os:cmd("while true; do echo hello; done&"),
+ [] = receive_all();
+ _ ->
+ ok % Cannot background on non-unix
+ end,
+
+ process_flag(trap_exit, false).
+
%% Test that the os:perf_counter api works as expected
perf_counter_api(_Config) ->
diff --git a/lib/kernel/vsn.mk b/lib/kernel/vsn.mk
index e88e4f9170..cdd200a234 100644
--- a/lib/kernel/vsn.mk
+++ b/lib/kernel/vsn.mk
@@ -1 +1 @@
-KERNEL_VSN = 5.0.1
+KERNEL_VSN = 5.0.2