aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
AgeCommit message (Collapse)Author
2018-09-17stdlib: Allow lists with binaries in the Format argumentHans Bolinder
As a consequence of some refactoring (OTP-14983, option 'chars_limit'), the Format argument of io_lib:format() no longer accepts binaries in lists in Erlang/OTP 21.0. Note that if Format is not of type io:format(), control sequences in Format are ignored. This can result in unpredictable behaviour if, for example, the output of io_lib:format() is used as Format: if the output happens to be a string(), then control sequences are interpreted, otherwise not. A check that Format is of type io:format() will likely be introduced in Erlang/OTP 22.0. That will probably mean work for some users, but considering how unpredictable io_lib:format() is, we should try to fix that.
2018-09-12[proc_lib] Improve crash reports for single line loggingSiri Hansen
2018-09-12[logger] Remove encoding option from logger_formatterSiri Hansen
The encoding option was introduced in commit 270d909696a753af022df72a404c73f2895b4a02, to allow report callbacks to format according to a given encoding. There was, however, no connection between this encoding option, and the encoding of the device to which the logger handler was writing. Since a formatter is defined to return unicode:chardata(), and in order to avoid mismatch with the encoding of the device, the encoding option is now removed from the formatter. The handler itself must make sure that it does not write illegal data to its device.
2018-08-31Fix type spec of ms_transform:parse_trans/2Péter Gömöri
It can also return errors and warnings.
2018-08-28Merge pull request #1940 from ↵Hans Bolinder
uabboli/hb/stdlib/fix_dets_file_name/OTP-15253/ERL-555 stdlib: Let dets:open_file() crash when given raw file name
2018-08-22stdlib: Fix specs of filename:basedir/2,2Hans Bolinder
See also https://bugs.erlang.org/browse/ERL-667.
2018-08-21stdlib: Let dets:open_file() crash when given raw file nameHans Bolinder
See also ERL-55 and OTP-13229.
2018-08-20stdlib: Correct contracts in module io_lib_formatHans Bolinder
2018-08-20stdlib: Improve error handling in module io_libHans Bolinder
2018-08-13Correct error behavior of is_map_key/2 in guardsBjörn Gustavsson
Consider the following functions: foo() -> bar(not_a_map). bar(M) when not is_map_key(a, M) -> ok; bar(_) -> error. What will `foo/0` return? It depends. If the module is compiled with the default compiler options, the return value will be `ok`. If the module is compiled with the `inline` option, the return value will be `error`. The correct value is `error`, because the call to `is_map_key/2` when the second argument is not a map should fail the entire guard. That is the way other failing guards BIFs are handled. For example: foo() -> bar(not_a_tuple). bar(T) when not element(1, T) -> ok; bar(_) -> error. `foo/0` always returns `error` (whether the code is inlined or not). This bug can be fixed by changing the classification of `is_map_key/2` in the `erl_internal` module. It is now classified as a type test, which is incorrect because type tests should not fail. Reclassifying it as a plain guard BIF corrects the bug. This correction also fixes the internal consistency check failure which was reported in: https://bugs.erlang.org/browse/ERL-699
2018-07-13Merge branch 'siri/logger/post-21/OTP-15132' into maintSiri Hansen
* siri/logger/post-21/OTP-15132: [logger] Allow setting kernel parameter 'logger_level' to 'all' [kernel] Reduce risk of dead lock when terminating logger_sup [logger] Fix regexp replacement for unicode strings Update proc_lib:report_cb to obey logger formatter's size limiting params [logger] Allow report callback with two arguments returning a string Don't call report_cb from cth_log_redirect - formatter does that Add legacy test of sasl_report_file_h and size limiting [logger] Remove compiler warnings in test [logger] Fix problem with test cases waiting for handler restart [logger] Add ?LOG macro which takes Level as argument [logger] Improve spec for set_handler_config/3 and set_primary_config/2 [logger] Generate .png file from .dia [logger] Update documentation
2018-07-13Update proc_lib:report_cb to obey logger formatter's size limiting paramsSiri Hansen
2018-07-04Merge branch 'maint-21' into maintJohn Högberg
* maint-21: Updated OTP version Update release notes Update version numbers Eliminate a crash in the beam_jump pass stdlib: Fix a 'chars_limit' bug Fix a race condition when generating async operation ids Fix internal compiler error for map_get/2 beam_type: Fix unsafe optimization public_key: Remove moduli 5121 and 7167 Thoose were added by 598629aeba9de98e8cdf5637043eb34e5d407751 but are not universaly supported.
2018-06-29Merge pull request #1853 from gomoripeti/fix_type_unary_opHans Bolinder
Fix typo in erl_parse type unary_op()
2018-06-28Fix typo in erl_parse type unary_op()Péter Gömöri
2018-06-28stdlib: Fix a 'chars_limit' bugHans Bolinder
2018-06-25stdlib: Add a few uses of erl_annoHans Bolinder
With DEBUG=true in erl_anno, erl_parse, and erl_pp a few (harmless) non-opaque accesses of annotations were found.
2018-06-18Update copyright yearHenrik Nord
2018-06-14Deprecate otp_mibsLukas Larsson
2018-06-13Merge branch 'raimo/stdlib/gen_statem-dev/OTP-14015'Raimo Niskanen
* raimo/stdlib/gen_statem-dev/OTP-14015: Show state changes in sys:trace
2018-06-12Show state changes in sys:traceRaimo Niskanen
2018-06-12Merge pull request #1835 from sirihansen/siri/logger-fixSiri Hansen
2018-06-12Merge branch 'peterdmv/stdlib/fix_uri_string_normalize/ERL-636/OTP-15112'Péter Dimitrov
* peterdmv/stdlib/fix_uri_string_normalize/ERL-636/OTP-15112: stdlib: Fix release_tests target in Makefile stdlib: Fix normalization function in uri_string Change-Id: I656a583befd8950d4326d15e60145c617acd41c3
2018-06-11Merge branch 'jl/sharpen-maps-tests/OTP-14012'Lukas Larsson
* jl/sharpen-maps-tests/OTP-14012: stdlib: Fix error reason for maps:with/without Check for the overlap between maps and iterators
2018-06-11stdlib: Fix normalization function in uri_stringPéter Dimitrov
- Fix parsing of hostnames that start with a number. - Update uri_string:parse/1 to be only responsible for parsing input URIs into URI components. Implicit percent-encoding normalization has been removed. - Implement percent-encoding normalization. - Update uri_string:normalize/{1,2} to include percent-encoding normalization. - Update test suites according to the new semantics. - Add new property test: normalize Change-Id: I6f37dcae2b3fcb4b29d286dbb0dfc563e8f211ae
2018-06-11Merge branch 'hasse/stdlib/pP_with_no_line_breaks/OTP-15103/ERL-607'Hans Bolinder
* hasse/stdlib/pP_with_no_line_breaks/OTP-15103/ERL-607: kernel: Use ~0p debugger: Use ~0p common_test: Use ~0p stdlib: Make pP insert no line breaks with field width zero
2018-06-08[logger] Change base OTP domain from [beam,erlang,otp] to [otp]Siri Hansen
2018-06-07stdlib: Move eval_str/1 from mod_esi to erl_evalHans Bolinder
See also https://bugs.erlang.org/browse/ERL-634. The utility program `erl_call' in erl_interface used to call lib:eval_str/1, which is no longer present in Erlang/OTP 21.0. The lib module was eliminated in OTP-15072, see also https://github.com/erlang/otp/pull/1786.
2018-06-07stdlib: Make pP insert no line breaks with field width zeroHans Bolinder
See also https://bugs.erlang.org/browse/ERL-607. A zero field width used to insert line breaks "everywhere", but with this patch no line breaks are inserted.
2018-06-05stdlib: Fix error reason for maps:with/withoutLukas Larsson
2018-06-05Merge branch 'dgud/stdlib/string-case-bin-bug'Dan Gudmundsson
* dgud/stdlib/string-case-bin-bug: Fix *case bugs for binaries
2018-06-04Merge branch 'hasse/dialyzer/improve_contract_warnings/OTP-14982'Hans Bolinder
* hasse/dialyzer/improve_contract_warnings/OTP-14982: erts: Improve contracts of zlib kernel: Improve contracts erts: Improve a contract stdlib: Improve a contract compiler: Improve a contract dialyzer: Refine the test for overspecified functions
2018-06-04Fix *case bugs for binariesDan Gudmundsson
Bad optimizing code introduced in 5c51e87bee9d
2018-06-04Merge branch 'lukas/stdlib/fix-io_o_request_raise/OTP-15101'Lukas Larsson
* lukas/stdlib/fix-io_o_request_raise/OTP-15101: stdlib: Fix io:put_chars/2 error
2018-05-30stdlib: Fix io:put_chars/2 errorLukas Larsson
Before this fix an error in io:put_chars/2 would signal a fault in io:put_chars/3 because of the way that raise is used and there is no such function.
2018-05-28stdlib: Improve a contractHans Bolinder
2018-05-23Merge branch 'ingela/gen-fsm-deprecation'Ingela Anderton Andin
* ingela/gen-fsm-deprecation: gen_fsm: should be deprecated eventually
2018-05-21Remove logger env vars for format_depth, max_size and utcSiri Hansen
These are replaced by new config handling and must not be used any more.
2018-05-21gen_fsm: should be deprecated eventuallyIngela Anderton Andin
2018-05-21Merge remote-tracking branch 'origin/ingela/ssl/deprecate-ssl-accept/OTP-15056'Ingela Anderton Andin
* origin/ingela/ssl/deprecate-ssl-accept/OTP-15056: ssl: Deprecate ssl:ssl_accept/[1,2,3]
2018-05-18ssl: Deprecate ssl:ssl_accept/[1,2,3]Ingela Anderton Andin
2018-05-18Merge branch 'sverker/ets-delete_all_objects-trap/OTP-15078'Sverker Eriksson
* sverker/ets-delete_all_objects-trap/OTP-15078: erts: Rename untrapping db_free_*empty*_table erts: Make ets:delete_all_objects yield on fixed table erts: Optimize ets delete all in fixed table erts: Refactor ets select iteration code erts: Cleanup ets code erts: Optimize ets hash object deallocactions erts: Refactor pseudo deleted ets objects erts: Make atomic ets:delete_all_objects yield erts: Fix reduction bump for ets:delete/1
2018-05-17Merge pull request #1810 from tomas-abrahamsson/bjorn/preprocessor-extensionsBjörn Gustavsson
Add ?OTP_RELEASE, -if and -elif to the preprocessor OTP-15087
2018-05-17Merge pull request #1817 from dgud/dgud/stdlib/string-opt-caseDan Gudmundsson
OTP-14988
2018-05-16Merge branch 'richcarl/eliminate_lib_module/PR-1786/OTP-15072'Hans Bolinder
* richcarl/eliminate_lib_module/PR-1786/OTP-15072: Fix minor issues Eliminate call to ct:get_progname() in ts_erl_config Use \n escape instead of integer 10 Move error formatting to erl_error.erl and delete lib.erl Move extended parse functions in lib.erl to erl_eval.erl Move lib:eval_str/1 into mod_esi.erl Remove lib:progname/0 Eliminate call to lib:progname/1 in slave.erl Add ct:get_progname/0 Remove lib:error_message/2 Remove lib:flush_receive/0 Remove lib:send/2 and lib:sendw/2 Move lib:nonl/1 into yecc.erl
2018-05-14Optimize string lowercase, uppercase and casefold for ASCII charactersDan Gudmundsson
2018-05-09Fix minor issuesRichard Carlsson
2018-05-09epp: Implement the -if and -elif preprocessor directivesBjörn Gustavsson
Libraries or applications that support more than one major release of OTP may need to use conditional compilation of Erlang source code. Here are few examples where it would be necessary or desirable: * To support a new data type or language feature only available in the latest major release (real-world examples: maps and the stacktrace syntax). * To avoid warnings for deprecated functions. * To avoid dialyzer warnings. Previously, to do conditional compilation, one would have to use a parse transform or some external tool such as 'autoconf'. To simplify conditional compilation, introduce the -if and -elif preprocessor directives, to allow code like this to be written: -if(?OTP_RELEASE =:= 21). %% Code that will only work in OTP 21. -else. %% Fallback code. -endif. What kind of expressions should be allowed after an -if? We certainly don't want to allow anything with a side effect, such as a '!' or a 'receive'. We also don't want it to be possible to call erlang:system_info/1, as that could make the code depedent on features of the run-time system that could change very easily (such as the number of schedulers). Requiring the expression to be a guard expression makes most sense. It is to explain in the documentation and easy for users to understand. For simplicity of implementation, only a single guard expression will be supported; that is, the ',' and ';' syntax for guards is not supported. To allow some useful conditions to be written, there is a special built-in function: defined(Symbol) tests whether the preprocessor symbol is defined, just like -ifdef. The reason for having this defined/1 is that the defined test can be combined with other tests, for example: 'defined(SOME_NAME) andalso ?OTP_RELEASE > 21'.
2018-05-08erts: Make atomic ets:delete_all_objects yieldSverker Eriksson
by using a cooperative strategy that will make any process accessing the table execute delelete_all_objects_continue until the table is empty. This is not an optimal solution as concurrent threads will still block on the table lock, but at least thread progress is made.
2018-05-08Merge pull request #1801 from dtip/update-global-name-specHans Bolinder
Update global name typespec