Age | Commit message (Collapse) | Author |
|
erl_tar: Fix handling of date and time
|
|
Since aa0c4b0df7cdc, erl_tar would write the local time (instead of
the POSIX time) into the tar header for the archived files. When
extracting the tar file, the extracted file could be set to a future
time (depending on the time zone).
We could do a minimal fix, but this seems to be a good time
to rewrite the time handling to use the new features that
allow file info to be read and written in the POSIX time
format.
First reported here: https://github.com/erlang/rebar3/issues/1554
|
|
Return error tuple on unicode normalization functions
|
|
Prior to this patch, the normalization functions in the
unicode module would raise a function clause error for
non-utf8 binaries.
This patch changes it so it returns {error, SoFar, Invalid}
as characters_to_binary and characters_to_list does in
the unicode module.
Note string:next_codepoint/1 and string:next_grapheme had
to be changed accordingly and also return an error tuple.
|
|
The linter emits warnings about using '_' as type variable in
parameterized types.
|
|
|
|
The postponed events, the user state and data, and the error
reason are all limited in error events (if the Kernel variable
error_logger_format_depth is set).
|
|
|
|
The size of the message queue and the dictionary is limited in
crash reports.
To avoid creating the potentially huge list of messages of the message
queue, messages are received (if the Kernel variable
error_logger_format_depth is set).
The tag 'message_queue_len' has been added to the crash report.
|
|
The state of the gen_server is limited in error events before exiting
(if the Kernel variable error_logger_format_depth is set).
An alternative is to let the error_logger limit all messages
(error_msg, format, warning_msg, info_msg), which would not limit
reports and also add a smallish overhead to event logging.
It is not decided if the alternative is to be implemented.
|
|
The term returned by io_lib:limit_term(Term, Depth) should return
the same string if substituted for Term in
io_lib:format("~P", [Term, Depth]) or io_lib:format("~W", [Term, Depth]).
|
|
proc_lib calls erlang:get_stacktrace/0 twice, which is unnecessary,
and potentially unsafe since there are calls to many functions
in between. Any of the calls could potentially cause and catch
an exception, invalidating the stacktrace.
Only call erlang:get_stacktrace/0 once, and pass the result to
the second place where it is needed.
|
|
It happens to work today, but it is potentially unsafe to call
io:format/2 before calling erlang:get_stacktrace/0. Make the
code safe by calling erlang:get_stacktrace/0 directly after
catching the exception.
|
|
Warn for potentially unsafe use of get_stacktrace/0
|
|
Prior to this patch, the stacktrace of an error or
exit in a callback would always be discarded in crash
reports. For example, an exit(crashed) in handle_call/3
would emit:
=CRASH REPORT==== 10-May-2017::14:15:50 ===
crasher:
initial call: gen_server_SUITE:init/1
pid: <0.201.0>
registered_name: []
exception exit: crashed
in function gen_server:terminate/8 (src/gen_server.erl, line 828)
Note that the stacktrace is pointing to the gen_server
internal terminate implementation that calls exit/1.
This patch uses erlang:raise/3 so the stacktrace is not
lost, allowing proc_lib to show the class, reason
and stacktrace coming from the user implementation
(in this case gen_server_SUITE):
=CRASH REPORT==== 10-May-2017::14:16:44 ===
crasher:
initial call: gen_server_SUITE:init/1
pid: <0.197.0>
registered_name: []
exception exit: crashed
in function gen_server_SUITE:handle_call/3 (gen_server_SUITE.erl, line 1529)
This change is completely backwards compatible as
using erlang:raise/3 will still emit the same exit
reason to any linked process and monitor as before.
|
|
Add option hibernate_after to gen_server, gen_statem and gen_event.
Also added to the deprecated gen_fsm behaviour.
OTP14405
|
|
erlang:get_stacktrace/0 returns the stacktrace for the latest
exception. The problem is that the stacktrace is kept until the next
exception occurs. If the last exception was a 'function_clause' or a
'badarg', the arguments for the call are also kept forever. The
arguments can be terms of any size (potentially huge).
In a future release, we would like to only allow
erlang:get_stacktrace/0 from within a 'try' expression. That would
make it possible to clear the stacktrace when the 'try' expression is
exited.
The 'catch' expression has no natural end where the stacktrace could
be cleared. The stacktrace could be cleared at the end of the function
that the 'catch' occurs in, but that would cause problems in the
following scenario (from real life, but simplified):
try
...
catch _:_ ->
io:format(...),
io:format("~p\n", [erlang:get_stacktrace()])
end.
%% In io.erl.
format(Fmt, Args) ->
Res = case ... of
SomePattern ->
catch...
...;
SomeOtherPattern ->
%% Output the formatted string here
...
end,
clear_stacktrace(), %% Inserted by compiler.
Res.
The call to io:format() would always clear the stacktrace before
it could be retrieved.
That problem could be solved by tightning the scope in which the
stacktrace is kept, but the rules for how long erlang:get_stacktrace/0
would work would become complicated.
Therefore, the solution we suggest for a future major release of
OTP is that erlang:get_stacktrace/0 will return [] if it is called
outside the 'catch' part of a 'try' expression.
To help users prepare, introduce a warning when it is likely that
erlang:get_stacktrace/0 will always return an empty list, for example
in this code:
catch error(foo),
Stk = erlang:get_stacktrace()
or in this code:
try Expr
catch _:_ -> ok end,
Stk = erlang:get_stacktrace()
|
|
In the future, erlang:get_stacktrace/0 will probably only work
inside a the 'catch' block of a 'try' expression.
Future-proof the code by rewriting the old-style catch to
a try...catch.
|
|
|
|
|
|
in case of active timers exists.
Added unit tests for hibernate_after functionality combined with gen_statem timers.
|
|
It was done because "hibernate_after" option already used in ssl for the same reason.
|
|
|
|
|
|
gen_event process's.
There is realized gen_server, gen_fsm, gen_event automatic hibernation functionality.
Added unit tests for realized functionality.
Added documentation for auto_hibernate_timeout option.
|
|
OTP-14531 Generic time-outs in gen_statem
Conflicts:
lib/stdlib/test/erl_internal_SUITE.erl
|
|
* hasse/stdlib/fix_qlc_bug/OTP-14296:
stdlib: Fix a test in sofs_SUITE
debugger: Improve handling of pids, ports, and refs
stdlib: Improve handling of pids, ports, and refs in qlc
stdlib: Improve the Erlang shell's handling of references
|
|
* rickard/ets-tid-fix/OTP-14094:
Fix typespec of the opaque type tid() of the ETS module
|
|
* hasse/unicode_atoms/OTP-14285:
stdlib: Add Unicode modifier t to control sequence a
stdlib: Add Unicode modifier t to control sequences w and W
|
|
* ingela/deprecate/gen_fsm/OTP-14183:
stdlib: Deprecate gen_fsm
Conflicts:
lib/stdlib/doc/src/gen_fsm.xml
|
|
|
|
The extended parser introduced in last commit is used in qlc for
solving an old bug: pids and refs could not be parsed by
string_to_handle(). The parser is also used for adjustments regarding
ETS identifiers (now references) in qlc_SUITE.
Notice that pids, references, ports, and external functions that
cannot be created in the currently running system cause syntax errors
(as before).
|
|
As of Erlang/OTP 20.0, the type of ETS tables, ets:tid(), is a
reference(). A request was put forward that the Erlang shell should be
able to handle references in its input.
This commit introduces an extended parser in module lib. It can parse
pids, ports, references, and external funs under the condition that
they can be created in the running system. The parser is meant to be
used internally in Erlang/OTP. The alternative, to extend erl_scan and
erl_parse, was deemed inferior as it would require the abstract format
be able to represent pids, ports, references, and funs, which would be
confusing as they are not expressions as such, but data types.
|
|
Introduce new "Dbgi" chunk
OTP-14369
|
|
* raimo/rand-dev/OTP-14295:
Polish
|
|
|
|
|
|
* lukas/erts/list_to_port/OTP-14348:
erts: Add erlang:list_to_port/1 debug bif
erts: Auto-import port_to_list for consistency
erts: Polish off erlang:list_to_ref/1
|
|
|
|
Follow the same pattern as pid_to_list
|
|
The new Dbgi chunk returns data in the following format:
{debug_info_v1, Backend, Data}
This allows compilers to store the debug info in different
formats. In order to retrieve a particular format, for
instance, Erlang Abstract Format, one may invoke:
Backend:debug_info(erlang_v1, Module, Data, Opts)
Besides introducing the chunk above, this commit also:
* Changes beam_lib:chunk(Beam, [:abstract_code]) to
read from the new Dbgi chunk while keeping backwards
compatibility with old .beams
* Adds the {debug_info, {Backend, Data}} option to
compile:file/2 and friends that are stored in the
Dbgi chunk. This allows the debug info encryption
mechanism to work across compilers
* Improves dialyzer to work directly on Core Erlang,
allowing languages that do not have the Erlang
Abstract Format to be dialyzer as long as they emit
the new chunk and their backend implementation is
available
Backwards compatibility is kept across the board except
for those calling beam_lib:chunk(Beam, ["Abst"]), as the
old chunk is no longer available. Note however the "Abst"
chunk has always been optional.
Future OTP versions may remove parsing the "Abst" chunk
altogether from beam_lib once Erlang 19 and earlier is no
longer supported.
The current Dialyzer implementation still supports earlier
.beam files and such may also be removed in future versions.
|
|
The Erlang shell's temporary support for Unicode node names is
removed. There will be no support for Unicode node names in
Erlang/OTP 20.0.
|
|
The Unicode translation modifier 't' is added to the io:fread/2,3
control sequence 'a'.
|
|
As of the introduction of Unicode characters in atoms, the control
sequences 'w' and 'W' can return non-Latin-1 characters, unless some
measure is taken.
This commit makes sure that '~w' and '~W' always return Latin-1
characters, or bytes, which can be output to ports or written to raw
files.
The Unicode translation modifier 't' is needed to return non-Latin-1
characters.
|
|
* dgud/stdlib/unicode-string/OTP-10289:
Handle chardata in string:to_float and string:to_list
New unicode aware string module that works with unicode:chardata()
Add nf(k)d, nf(k)c conversion functions to unicode module
Reorder code and whitespace fixes
Add unicode_util
|
|
|
|
Works with unicode:chardata() as input as was decided on OTP board
meeting as response to EEP-35 a long time ago.
Works on graphemes clusters as base, with a few exceptions, does not
handle classic (nor nfd'ified) Hangul nor the extended grapheme
clusters such as the prepend class. That would make handling binaries
as input/output very slow.
List input => list output, binary input => binary output and
mixed input => mixed output for all find/split functions.
So that results can be post-processed without the need to invoke
unicode:characters_to_list|binary for intermediate data.
pad functions return lists of unicode:chardata() for performance.
|
|
|
|
Put internal functions below api functions.
|
|
A base for unicode functions, not intended to be a user api.
Whitespace returns a reasonable subset of non nobreak whitespace
characters.
Implementation notes:
Make function clauses instead of using arrays and store tuples instead
of maps to save space.
|