<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/stdlib/src, branch OTP-21.1.4</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>stdlib: Allow lists with binaries in the Format argument</title>
<updated>2018-09-17T11:19:30+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-09-17T08:33:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=2d04d2bdf95c3a5f143ed2a5b9295fbf197b9b0b'/>
<id>2d04d2bdf95c3a5f143ed2a5b9295fbf197b9b0b</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>[proc_lib] Improve crash reports for single line logging</title>
<updated>2018-09-12T12:58:02+00:00</updated>
<author>
<name>Siri Hansen</name>
<email>siri@erlang.org</email>
</author>
<published>2018-09-12T12:54:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=98bfd0c19ca1f563c18c252d58801c2c5731861a'/>
<id>98bfd0c19ca1f563c18c252d58801c2c5731861a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[logger] Remove encoding option from logger_formatter</title>
<updated>2018-09-12T12:58:02+00:00</updated>
<author>
<name>Siri Hansen</name>
<email>siri@erlang.org</email>
</author>
<published>2018-08-31T15:08:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=96c1aa0041b368afceef0aef88e82a6c9f8e901d'/>
<id>96c1aa0041b368afceef0aef88e82a6c9f8e901d</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix type spec of ms_transform:parse_trans/2</title>
<updated>2018-08-30T23:29:42+00:00</updated>
<author>
<name>Péter Gömöri</name>
<email>gomoripeti@gmail.com</email>
</author>
<published>2018-08-30T23:29:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a9e5bbd355a8ba191dca4c1d0fffb54ccef17b7d'/>
<id>a9e5bbd355a8ba191dca4c1d0fffb54ccef17b7d</id>
<content type='text'>
It can also return errors and warnings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It can also return errors and warnings.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #1940 from uabboli/hb/stdlib/fix_dets_file_name/OTP-15253/ERL-555</title>
<updated>2018-08-28T06:32:08+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-08-28T06:32:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=8d22b08cddb654d49cf86a43e2d31e5736e347fe'/>
<id>8d22b08cddb654d49cf86a43e2d31e5736e347fe</id>
<content type='text'>
stdlib: Let dets:open_file() crash when given raw file name</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
stdlib: Let dets:open_file() crash when given raw file name</pre>
</div>
</content>
</entry>
<entry>
<title>stdlib: Fix specs of filename:basedir/2,2</title>
<updated>2018-08-22T07:37:14+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-08-20T13:56:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d34ce3fba8d649ebbc371861c7f1126de97295ef'/>
<id>d34ce3fba8d649ebbc371861c7f1126de97295ef</id>
<content type='text'>
See also https://bugs.erlang.org/browse/ERL-667.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See also https://bugs.erlang.org/browse/ERL-667.
</pre>
</div>
</content>
</entry>
<entry>
<title>stdlib: Let dets:open_file() crash when given raw file name</title>
<updated>2018-08-21T06:20:53+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-08-21T06:10:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=4734964a6290c32fc20095d46140053e193379f5'/>
<id>4734964a6290c32fc20095d46140053e193379f5</id>
<content type='text'>
See also ERL-55 and OTP-13229.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See also ERL-55 and OTP-13229.
</pre>
</div>
</content>
</entry>
<entry>
<title>stdlib: Correct contracts in module io_lib_format</title>
<updated>2018-08-20T12:05:56+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-06-26T13:45:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=52ca4ae9db150cc89d44974e516589298b040c17'/>
<id>52ca4ae9db150cc89d44974e516589298b040c17</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>stdlib: Improve error handling in module io_lib</title>
<updated>2018-08-20T12:05:56+00:00</updated>
<author>
<name>Hans Bolinder</name>
<email>hasse@erlang.org</email>
</author>
<published>2018-06-26T13:05:00+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a00f10d6e65f64d3b47e7c32e82c6ccf611d46ff'/>
<id>a00f10d6e65f64d3b47e7c32e82c6ccf611d46ff</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Correct error behavior of is_map_key/2 in guards</title>
<updated>2018-08-13T07:26:36+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-08-10T05:43:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=7e1eb2ed1f724945884d839bd8a99154e9382849'/>
<id>7e1eb2ed1f724945884d839bd8a99154e9382849</id>
<content type='text'>
Consider the following functions:

    foo() -&gt; bar(not_a_map).

    bar(M) when not is_map_key(a, M) -&gt; ok;
    bar(_) -&gt; 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() -&gt; bar(not_a_tuple).

    bar(T) when not element(1, T) -&gt; ok;
    bar(_) -&gt; 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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Consider the following functions:

    foo() -&gt; bar(not_a_map).

    bar(M) when not is_map_key(a, M) -&gt; ok;
    bar(_) -&gt; 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() -&gt; bar(not_a_tuple).

    bar(T) when not element(1, T) -&gt; ok;
    bar(_) -&gt; 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
</pre>
</div>
</content>
</entry>
</feed>
