20042011 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. STDLIB Release Notes notes.xml

This document describes the changes made to the STDLIB application.

STDLIB 1.17.3
Fixed Bugs and Malfunctions

Two bugs in io:format for ~F.~Ps has been corrected. When length(S) >= abs(F) > P, the precision P was incorrectly ignored. When F == P > lenght(S) the result was incorrectly left adjusted. Bug found by Ali Yakout who also provided a fix.

Own Id: OTP-8989 Aux Id: seq11741

Fix exception generation in the io module

Some functions did not generate correct badarg exception on a badarg exception.

Own Id: OTP-9045

Fixes to the dict and orddict module documentation

Fixed grammar and one inconsistency (Key - Value instead of key/value, since everywhere else the former is used). (thanks to Filipe David Manana)

Own Id: OTP-9083

Add ISO week number calculation functions to the calendar module in stdlib

This new feature adds the missing week number function to the calendar module of the stdlib application. The implementation conforms to the ISO 8601 standard. The new feature has been implemented tested and documented (thanks to Imre Horvath).

Own Id: OTP-9087

Improvements and New Features

Implement the 'MAY' clauses from RFC4648 regarding the pad character to make mime_decode() and mime_decode_to_string() functions more tolerant of badly padded base64. The RFC is quoted below for easy reference.

"RFC4648 Section 3.3 with reference to MIME decoding: Furthermore, such specifications MAY ignore the pad character, "=", treating it as non-alphabet data, if it is present before the end of the encoded data. If more than the allowed number of pad characters is found at the end of the string (e.g., a base 64 string terminated with "==="), the excess pad characters MAY also be ignored."

Own Id: OTP-9020

Supervisors will no longer save start parameters for temporary processes as they will not be restarted. In the case of simple_one_for_one workers such as ssl-connection processes this will substantial reduce the memory footprint of the supervisor.

Own Id: OTP-9064

When running escript it is now possible to add the -n flag and the escript will be compiled using +native.

Own Id: OTP-9076

STDLIB 1.17.2.1
Fixed Bugs and Malfunctions

Several type specifications for standard libraries were wrong in the R14B01 release. This is now corrected. The corrections concern types in re,io,filename and the module erlang itself.

Own Id: OTP-9008

STDLIB 1.17.2
Fixed Bugs and Malfunctions

When several clients accessed a Dets table simultaneously, one of them calling dets:insert_new/2, the Dets server could crash. Alternatively, under the same conditions, ok was sometimes returned instead of true. (Thanks to John Hughes.)

Own Id: OTP-8856

When several clients accessed a Dets table simultaneously, inserted or updated objects were sometimes lost due to the Dets file being truncated. (Thanks to John Hughes.)

Own Id: OTP-8898

When several clients accessed a Dets table simultaneously, modifications of the Dets server's internal state were sometimes thrown away. The symptoms are diverse: error with reason bad_object; inserted objects not returned by lookup(); et cetera. (Thanks to John Hughes.)

Own Id: OTP-8899

If a Dets table was closed after calling bchunk/2, match/1,3, match_object/1,3, or select/1,3 and then opened again, a subsequent call using the returned continuation would normally return a reply. This bug has fixed; now the call fails with reason badarg.

Own Id: OTP-8903

Cover did not collect coverage data for files such as Yecc parses containing include directives. The bug has been fixed by modifying epp, the Erlang Code Preprocessor.

Own Id: OTP-8911

If a Dets table with fewer slots than keys was opened and then closed after just a lookup, the contents were no longer well-formed. This bug has been fixed. (Thanks to Matthew Evans.)

Own Id: OTP-8923

In a supervisor, when it terminates a child, if that child happens to have exited fractionally early, with normal, the supervisor reports this as an error. This should not be reported as an error.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8938 Aux Id: seq11615

Improvements and New Features

The documentation filelib:wildcard/1,2 now describes the character set syntax for wildcards.

Own Id: OTP-8879 Aux Id: seq11683

Buffer overflows have been prevented in erlc, dialyzer, typer, run_test, heart, escript, and erlexec.

(Thanks to Michael Santos.)

Own Id: OTP-8892

Using a float for the number of copies for string:copies/2 resulted in an infinite loop. Now it will fail with an exception instead. (Thanks to Michael Santos.)

Own Id: OTP-8915

New ETS option compressed, to enable a more compact storage format at the expence of heavier table operations. For test and evaluation, erl +ec can be used to force compression on all ETS tables.

Own Id: OTP-8922 Aux Id: seq11658

The default maximum number of slots of a Dets table has been changed as to be equal to the maximum number of slots. (Thanks to Richard Carlsson.)

Own Id: OTP-8959

STDLIB 1.17.1
Fixed Bugs and Malfunctions

reference() has been substituted for ref() in the documentation.

Own Id: OTP-8733

Improvements and New Features

The ms_transform now warns if the fun head shadows surrounding variables (just like the warnings you would get for an ordinary fun in the same context).

Own Id: OTP-6759

ets:select_reverse/{1,2,3} are now documented.

Own Id: OTP-7863

Large parts of the ethread library have been rewritten. The ethread library is an Erlang runtime system internal, portable thread library used by the runtime system itself.

Most notable improvement is a reader optimized rwlock implementation which dramatically improve the performance of read-lock/read-unlock operations on multi processor systems by avoiding ping-ponging of the rwlock cache lines. The reader optimized rwlock implementation is used by miscellaneous rwlocks in the runtime system that are known to be read-locked frequently, and can be enabled on ETS tables by passing the {read_concurrency, true} option upon table creation. See the documentation of ets:new/2 for more information. The reader optimized rwlock implementation can be fine tuned when starting the runtime system. For more information, see the documentation of the +rg command line argument of erl.

There is also a new implementation of rwlocks that is not optimized for readers. Both implementations interleaves readers and writers during contention as opposed to, e.g., the NPTL (Linux) pthread rwlock implementation which use either a reader or writer preferred strategy. The reader/writer preferred strategy is problematic since it starves threads doing the non-preferred operation.

The new rwlock implementations in general performs better in ERTS than common pthread implementations. However, in some extremely heavily contended cases this is not the case. Such heavy contention can more or less only appear on ETS tables. This when multiple processes do very large amounts of write locked operations simultaneously on the same table. Such use of ETS is bad regardless of rwlock implementation, will never scale, and is something we strongly advise against.

The new rwlock implementations depend on atomic operations. If no native atomic implementation is found, a fallback solution will be used. Using the fallback implies a performance degradation. That is, it is more important now than before to build OTP with a native atomic implementation.

The ethread library contains native atomic implementations for, x86 (32 and 64 bit), powerpc (32 bit), sparc V9 (32 and 64 bit), and tilera (32 bit). On other hardware gcc's builtin support for atomic memory access will be used if such exists. If no such support is found, configure will warn about no atomic implementation available.

The ethread library can now also use the libatomic_ops library for atomic memory accesses. This makes it possible for the Erlang runtime system to utilize optimized native atomic operations on more platforms than before. If configure warns about no atomic implementation available, try using the libatomic_ops library. Use the --with-libatomic_ops=PATH configure command line argument when specifying where the libatomic_ops installation is located. The libatomic_ops library can be downloaded from: http://www.hpl.hp.com/research/linux/atomic_ops/

The changed API of the ethread library has also caused modifications in the Erlang runtime system. Preparations for the to come "delayed deallocation" feature has also been done since it depends on the ethread library.

Note: When building for x86, the ethread library will now use instructions that first appeared on the pentium 4 processor. If you want the runtime system to be compatible with older processors (back to 486) you need to pass the --enable-ethread-pre-pentium4-compatibility configure command line argument when configuring the system.

Own Id: OTP-8544

Some Built In Functions (BIFs) from the module erlang was never made autoimported for backward compatibility reasons. As local functions now override autoimports, new autoimports is no longer a problem, why the following BIFs are finally made autoimported: monitor/2, monitor/3, demonitor/2, demonitor/3, error/1, error/2, integer_to_list/2, list_to_integer/2.

Own Id: OTP-8763

STDLIB 1.17
Fixed Bugs and Malfunctions

The Erlang code preprocessor (epp) sent extra messages on the form {eof,Location} to the client when parsing the file attribute. This bug, introduced in R11B, has been fixed.

Own Id: OTP-8470

The abstract type 'fun' could not be printed by the Erlang pretty printer (erl_pp). This bug has been fixed.

Own Id: OTP-8473

The function erl_scan:reserved_word/1 no longer returns true when given the word spec. This bug was introduced in STDLIB-1.15.3 (R12B-3).

Own Id: OTP-8567

The documentation of lists:keysort/2 states that the sort is stable.

Own Id: OTP-8628 Aux Id: seq11576

The shell's line editing has been improved to more resemble the behaviour of readline and other shells. (Thanks to Dave Peticolas)

Own Id: OTP-8635

The Erlang code preprocessor (epp) did not correctly handle premature end-of-input when defining macros. This bug, introduced in STDLIB 1.16, has been fixed.

Own Id: OTP-8665 Aux Id: OTP-7810

Improvements and New Features

The module binary from EEP31 (and EEP9) is implemented.

Own Id: OTP-8217

The erlang pretty printer (erl_pp) no longer quotes atoms in types.

Own Id: OTP-8501

The Erlang code preprocessor (epp) now considers records with no fields as typed.

Own Id: OTP-8503

Added function zip:foldl/3 to iterate over zip archives.

Added functions to create and extract escripts. See escript:create/2 and escript:extract/2.

The undocumented function escript:foldl/3 has been removed. The same functionality can be achieved with the more flexible functions escript:extract/2 and zip:foldl/3.

Record fields has been annotated with type info. Source files as been adapted to fit within 80 chars and trailing whitespace has been removed.

Own Id: OTP-8521

The Erlang parser no longer duplicates the singleton type undefined in the type of record fields without initial value.

Own Id: OTP-8522

A regular expression with many levels of parenthesis could cause a buffer overflow. That has been corrected. (Thanks to Michael Santos.)

Own Id: OTP-8539

When defining macros the closing right parenthesis before the dot is now mandatory.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8562

Some properties of a compiled re pattern are defined to allow for guard tests.

Own Id: OTP-8577

Local and imported functions now override the auto-imported BIFs when the names clash. The pre R14 behaviour was that auto-imported BIFs would override local functions. To avoid that old programs change behaviour, the following will generate an error:

Doing a call without explicit module name to a local function having a name clashing with the name of an auto-imported BIF that was present (and auto-imported) before OTP R14A

Explicitly importing a function having a name clashing with the name of an autoimported BIF that was present (and autoimported) before OTP R14A

Using any form of the old compiler directive nowarn_bif_clash

If the BIF was added or auto-imported in OTP R14A or later, overriding it with an import or a local function will only result in a warning,

To resolve clashes, you can either use the explicit module name erlang to call the BIF, or you can remove the auto-import of that specific BIF by using the new compiler directive -compile({no_auto_import,[F/A]})., which makes all calls to the local or imported function without explicit module name pass without warnings or errors.

The change makes it possible to add auto-imported BIFs without breaking or silently changing old code in the future. However some current code ingeniously utilizing the old behaviour or the nowarn_bif_clash compiler directive, might need changing to be accepted by the compiler.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8579

The undocumented, unsupport, and deprecated function lists:flat_length/1 has been removed.

Own Id: OTP-8584

A bug in re that could cause certain regular expression matches never to terminate is corrected. (Thanks to Michael Santos and Gordon Guthrie.)

Own Id: OTP-8589

Nested records can now be accessed without parenthesis. See the Reference Manual for examples. (Thanks to YAMASHINA Hio and Tuncer Ayaz.)

Own Id: OTP-8597

receive statements that can only read out a newly created reference are now specially optimized so that it will execute in constant time regardless of the number of messages in the receive queue for the process. That optimization will benefit calls to gen_server:call(). (See gen:do_call/4 for an example of a receive statement that will be optimized.)

Own Id: OTP-8623

The beam_lib:cmp/2 function now compares BEAM files in stricter way. The BEAM files will be considered different if there are any changes except in the compilation information ("CInf") chunk. beam_lib:cmp/2 used to ignore differences in the debug information (significant for Dialyzer) and other chunks that did not directly change the run-time behavior.

Own Id: OTP-8625

When a gen_server, gen_fsm process, or gen_event terminates abnormally, sometimes the text representation of the process state can occupy many lines of the error log, depending on the definition of the state term. A mechanism to trim out parts of the state from the log has been added (using a format_status/2 callback). See the documentation.

Own Id: OTP-8630

Calling sys:get_status() for processes that have globally registered names that were not atoms would cause a crash. Corrected. (Thanks to Steve Vinoski.)

Own Id: OTP-8656

The Erlang scanner has been augmented with two new tokens: .. and ....

Own Id: OTP-8657

Expressions evaluating to integers can now be used in types and function specifications where hitherto only integers were allowed ("Erlang_Integer").

Own Id: OTP-8664

The compiler optimizes record operations better.

Own Id: OTP-8668

The recently added BIFs erlang:min/2, erlang:max/2 and erlang:port_command/3 are now auto-imported (as they were originally intended to be). Due to the recent compiler change (OTP-8579), the only impact on old code defining it's own min/2, max/2 or port_command/3 functions will be a warning, the local functions will still be used. The warning can be removed by using -compile({no_auto_import,[min/2,max/2,port_command/3]}). in the source file.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8669 Aux Id: OTP-8579

Now, binary_to_term/2 is auto-imported. This will cause a compile warning if and only if a module has got a local function with that name.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8671

The predefined builtin type tid() has been removed. Instead, ets:tid() should be used.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8687

STDLIB 1.16.5
Fixed Bugs and Malfunctions

Because of a race condition, using filelib:ensure_dir/1 from multiple processes to create the same path or parts of the same directory structure, filelib:ensure_dir/1 could return a meaningless {error,eexist}. That race condition has been eliminated, and {error,eexist} will now be returned only if there exists a regular file, device file, or some other non-directory file with the same name. (Thanks to Tuncer Ayaz.)

Own Id: OTP-8389

A number of bugs concerning re and unicode are corrected:

re:compile no longer loses unicode option, which also fixes bug in re:split.

re:replace now handles unicode charlist replacement argument

re:replace now handles unicode RE charlist argument correctly

re:replace now handles binary unicode output correctly when nothing is replaced.

Most code, testcases and error isolation done by Rory Byrne.

Own Id: OTP-8394

The loading of native code was not properly atomic in the SMP emulator, which could cause crashes. Also a per-MFA information table for the native code has now been protected with a lock since it turns that it could be accessed concurrently in the SMP emulator. (Thanks to Mikael Pettersson.)

Own Id: OTP-8397

user.erl (used in oldshell) is updated to handle unicode in prompt strings (io:get_line/{1,2}). io_lib is also updated to format prompts with the 't' modifier (i.e. ~ts instead of ~s).

Own Id: OTP-8418 Aux Id: OTP-8393

The re module: A regular expression with an option change at the start of a pattern that had top-level alternatives could cause overwriting and/or a crash. (Thanks to Michael Santos.)

Own Id: OTP-8438

Improvements and New Features

The ability for the gen_server and gen_fsm callback modules to format their own state for display under the sys:get_status/1,2 calls has been restored and documented. (Thanks to Steve Vinoski.)

Own Id: OTP-8324

c:nc/{1,2} used to assume that the beam file was created in the same directory as the source code and failed to load the code if it was not. Corrected to look for the beam file in the current directory or in the directory specified by the {outdir,Dir} option. (Thanks to Alex Suraci.)

Own Id: OTP-8337

The documentation is now possible to build in an open source environment after a number of bugs are fixed and some features are added in the documentation build process.

- The arity calculation is updated.

- The module prefix used in the function names for bif's are removed in the generated links so the links will look like "http://www.erlang.org/doc/man/erlang.html#append_element-2" instead of "http://www.erlang.org/doc/man/erlang.html#erlang:append_element-2".

- Enhanced the menu positioning in the html documentation when a new page is loaded.

- A number of corrections in the generation of man pages (thanks to Sergei Golovan)

- The legal notice is taken from the xml book file so OTP's build process can be used for non OTP applications.

Own Id: OTP-8343

Shell tab completion now works for quoted module and function names. (Thanks to Ulf Wiger.)

Own Id: OTP-8383

Explicit top directories in archive files are now optional.

For example, if an archive (app-vsn.ez) just contains an app-vsn/ebin/mod.beam file, the file info for the app-vsn and app-vsn/ebin directories are faked using the file info from the archive file as origin. The virtual direcories can also be listed. For short, the top directories are virtual if they does not exist.

Own Id: OTP-8387

Macros overloading has been implemented. (Thanks to Christopher Faulet.)

Own Id: OTP-8388

The new function shell:prompt_func/1 and the new application configuration parameter shell_prompt_func can be used for customizing the Erlang shell prompt.

Own Id: OTP-8393

Improved handling of typed records in escripts

Own Id: OTP-8434

Added supervisor:count_children/1 to count the number of children being managed without the memory impact of which_children/1. (Thanks to Jay Nelson.)

Own Id: OTP-8436

STDLIB 1.16.4
Improvements and New Features

The documentation is now built with open source tools (xsltproc and fop) that exists on most platforms. One visible change is that the frames are removed.

Own Id: OTP-8201

[escript] The restriction that the first line in escripts must begin with #! has been removed.

[escript] Some command line options to the escript executable has now been documented. For example you can run an escript in the debugger by just adding a command line option.

[escript] The documentation of the escript header syntax has been clarified. For example the header is optional. This means that it is possible to directly "execute" .erl, .beam and.zip files.

Own Id: OTP-8215

Optimized array:from_orddict/1, it is now faster and uses less memory if the orddict was sparse.

Changed array:reset/2, it will now never expand the array which it could before for non fixed arrays. See the documentation.

Own Id: OTP-8216

The Erlang Pretty Printer (erl_pp) now puts the leading [ of list comprehensions as well as the leading << of bit string comprehensions on a separate line in order to expose the Cover counter of the template.

Own Id: OTP-8227

The extension ".xrl" used for Leex input files is now recognized by the compiler.

Own Id: OTP-8232

Some clarifications have been made in the documentation regarding gen_server, gen_fsm, and gen_event behavior when handling 'EXIT' messages from the parent process. For more information see the gen_server(3), gen_fsm(3), and gen_event(3) documentation.

Own Id: OTP-8255 Aux Id: seq11419

The -on_load() directive can be used to run a function when a module is loaded. It is documented in the section about code loading in the Reference Manual.

Own Id: OTP-8295

STDLIB 1.16.3.1
Fixed Bugs and Malfunctions

An erroneous type spec for gen:start/6 caused dialyzer to erroneously issue warnings when {spawn_opt, SpawnOptionList} was passed in the option list to the gen_server and gen_fsm start functions.

Own Id: OTP-8068 Aux Id: seq11323, seq11314

STDLIB 1.16.3
Fixed Bugs and Malfunctions

The linter used to crash on invalid -opaque declarations.

Own Id: OTP-8051

Bugs in digraph:add_edge/5 and digraph:del_path/3 have been fixed. (Thanks to Crystal Din.)

Own Id: OTP-8066

When trying to insert objects with dets:insert_new() into a Dets table of type duplicate_bag, already existing objects would sometimes be duplicated. This bug has been fixed. (Thanks to Crystal Din.)

Own Id: OTP-8070

Running erlc in a very deep directory (with a path length of more 256 or more characters) would cause the emulator to crash in a call to list_to_atom/1. (Thanks to Chris Newcombe.)

Own Id: OTP-8124

A few minor bugs have been fixed in the Erlang Code Preprocessor (epp).

Own Id: OTP-8130

A bug in The Erlang Meta Interpreter (erl_eval) has been fixed: exceptions generated in the template of bit string comprehensions were not handled properly. (Thanks to Ulf Wiger.)

Own Id: OTP-8133

Improvements and New Features

Option {capture,none} was missing in documentation for re:run/3.

Own Id: OTP-8113

When erl_scan:tokens() returns an error tuple {error, ErrorInfo, EndLocation}, the list LeftOverChars is the remaining characters of the input data, starting from EndLocation. It used to be the empty list.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-8129

The Erlang Meta Interpreter (erl_eval) has been somewhat optimized when it comes to interpreting receive-expressions. (Thanks to Richard Carlsson.)

Own Id: OTP-8139

The Erlang Pretty Printer (erl_pp) has been modified as to handle types.

Own Id: OTP-8150

STDLIB 1.16.2
Fixed Bugs and Malfunctions

The text of tokens returned by the Erlang scanner (erl_scan) was sometimes empty when the text option was given and StartLocation was a line. This bug has been fixed.

Own Id: OTP-7965

The documentation for base64:decode/1 has been updated to point out that it strips whitespace.

base64:decode/1 and base64:mime_decode/1 would sometimes fail instead of stripping away non-base64 characters.

Own Id: OTP-7984

Two types in the gen module were corrected.

Own Id: OTP-8029 Aux Id: seq11296

array:from_orddict([]) and array:from_list([]) would construct fixed arrays instead of extendible arrays.

Own Id: OTP-8033

Improvements and New Features

Interpreted escripts are now tail recursive.

The function erl_eval:expr/5 has been introduced.

Own Id: OTP-7933

gen_server:call/2,3 will be somewhat faster if the calling process has a many messages in its message queue.

Own Id: OTP-7979

Random now supports seed with arity one, random:seed/1, which takes a three-tuple.

Own Id: OTP-8019

The regexp module now recognizes the escape sequences \xXY and \x{X...}.

Own Id: OTP-8024

STDLIB 1.16.1
Fixed Bugs and Malfunctions

The documentation of dets:open_file/1 now states that the file is repaired if it has not been properly closed. (Thanks to Ulf Wiger.)

Own Id: OTP-7895

Improvements and New Features

The Erlang scanner no longer returns the text of tokens when the start location is a pair of a line and column unless the new option text is supplied (incompatibility with R13A).

There are new functions to access the attributes of tokens: attributes_info/1,2 and set_attribute/3.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7892 Aux Id: OTP-7810

Several glitches and performance issues in the Unicode and I/O-system implementation of R13A have been corrected.

Own Id: OTP-7896 Aux Id: OTP-7648 OTP-7887

The type spec of filelib:wildcard/2 has been corrected.

Own Id: OTP-7915

New functions: gb_sets:is_disjoint/2, ordsets:is_disjoint/2, and gb_sets:is_disjoint/2.

Own Id: OTP-7947

The function gb_trees:map/2 which was added in R13A is now documented.

Own Id: OTP-7948

STDLIB 1.16
Fixed Bugs and Malfunctions

Fixed a minor race conditions in gen_server:start*: if one of these functions returned {error,Reason} or ignore, the name could still be registered (either locally or in global).

A process started by proc_lib in some cases depended on its process dictionary not to be erased, and would crash when terminating abnormally and not generate a proper crash report. This has been corrected (but the initial call will not be shown in the error report if the process dictionary has been erased). NOTE: There is no longer any need to erase the process dictionary for memory conservation reasons, since the actual call arguments are no longer saved in the process dictionary.

Own Id: OTP-7669

The Erlang preprocessor used wrong line number when stringifying macro arguments. (Thanks to John Hughes.)

Own Id: OTP-7702

A bug in the qlc module has been fixed: merge join sometimes failed to return all answers. (Thanks to Bernard Duggan.)

Own Id: OTP-7714

Improvements and New Features

A new option, key_equality, has been added to qlc:table/2. This option makes it possible for qlc to better handle tables that use ==/2 when comparing keys for equality (examples of such tables are ordered ETS tables and gb_table in qlc(3)).

Own Id: OTP-6674

The functions lists:seq/1,2 return the empty list in a few cases when they used to generate an exception, for example lists:seq(1, 0). See lists(3) for details. (Thanks to Richard O'Keefe.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7230

The order of objects visited in select for ordered_set is now documented.

Own Id: OTP-7339

It is now possible to debug code in escripts and archives.

Own Id: OTP-7626

Support for Unicode is implemented as described in EEP10. Formatting and reading of unicode data both from terminals and files is supported by the io and io_lib modules. Files can be opened in modes with automatic translation to and from different unicode formats. The module 'unicode' contains functions for conversion between external and internal unicode formats and the re module has support for unicode data. There is also language syntax for specifying string and character data beyond the ISO-latin-1 range.

The interactive shell will support input and output of unicode characters when the terminal and operating system supports it.

Please see the EEP and the io/io_lib manual pages as well as the stdlib users guide for details.

I/O-protocol incompatibilities:

The io_protocol between io_Server and client is updated to handle protocol data in unicode formats. The updated protocol is now documented. The specification resides in the stdlib users manual, which is a new part of the manual.

io module incompatibilities:

The io:put_chars, io:get_chars and io:get_line all handle and return unicode data. In the case where binaries can be provided (as to io:put_chars), they shall be encoded in UTF-8. When binaries are returned (as by io:get_line/get_chars when the io_server is set in binary mode) the returned data is also always encoded as UTF-8. The file module however still returns byte-oriented data, why file:read can be used instead of io:get_chars to read binary data in ISO-latin-1.

io_lib module incompatibilities:

io_lib:format can, given new format directives (i.e "~ts" and "~tc"), return lists containing integers larger than 255.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7648 Aux Id: OTP-7580 OTP-7514 OTP-7494 OTP-7443 OTP-7181 EEP10 EEP11

The function pool:attach/1 now returns already_attached if the node is already attached, rather than allready_attached (sic!). (Thanks to Edwin Fine.)

Own Id: OTP-7653 Aux Id: OTP-7603

Preprocessor directives are now allowed in escripts. This means that for example macros may be used in escripts.

Own Id: OTP-7662

When a process started with proc_lib, gen_server, or gen_fsm exits with reason {shutdown,Term}, a crash report will no longer be generated (to allow a clean shutdown, but still provide additional information to process that are linked to the terminating process).

Own Id: OTP-7740 Aux Id: seq10847

A new BIF, lists:keyfind/3, has been added. It works like lists:keysearch/3 except that it does not wrap the returned tuple in a value tuple in case of success. (Thanks to James Hague for suggesting this function.)

Own Id: OTP-7752

lists:suffix(Suffix, List) used to have a a complexity of length(Suffix)*length(List) (which could become quite slow for some inputs). It has now been re-implemented so that its complexity is length(Suffix)+length(List). (Thanks to Richard O'Keefe for the new implementation.)

Own Id: OTP-7797

The Erlang scanner has been augmented as to return white spaces, comments, and exact location of tokens. The functions string/3, tokens/4, and token_info/1,2 are new. See erl_scan(3) for details.

tokens/3,4 have been modified as to return a list of tokens instead of an error when eof is encountered before the dot.

Own Id: OTP-7810

filelib:fold_files/5 now uses the re module instead of the regexp module for regular expression matching. In practice, this change will not be a problem for most regular expressions used for filelib:fold_files/5. (The major difference in regular expression is that parenthesis and curly brackets is treated as literal characters by regexp but as special characters by re; fortunately, those characters are rarely used in filenames.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7819

digraph:new(Type) will now cause a badarg exception if Type is not a valid type. Similarly, digraph_utils:subgraph/2,3 will now cause a badarg if the arguments are invalid. (Those functions used to return error tuples if something was wrong.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7824

The argument passed to random:uniform/1 must now be an integer (as stated in the documentation). In previous releases, a floating point number was also allowed.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7827

The copyright notices have been updated.

Own Id: OTP-7851

A few missing match spec functions was added to dbg:fun2ms; exception_trace/0 and trace/2,3.

There is a new function queue:member/2.

A bug in io_lib:fread that made it accidentally concatenate fields separated by newline has been corrected. Reported and analyzed by Matthew Palmer to erlang-patches.

Own Id: OTP-7865

STDLIB 1.15.5
Fixed Bugs and Malfunctions

A bug in the qlc module has been fixed: when merge joining two query handles the temporary file used for equivalence classes was not truncated properly which could result in poor performance.

Own Id: OTP-7552

The characters 16#C0 and 16#E0 ("A" and "a" with grave accent), were not properly converted by the string:to_lower/1 and string:to_upper/1 functions. (Thanks to Richard O'Keefe.)

Own Id: OTP-7589

The function pool:attach/1 now returns already_attached if the node is already attached, rather than allready_attached (sic!). (Thanks to Edwin Fine.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7603

The documentation for io:get_line/1,2 now mentions that the return value can also be {error,Reason}.

Own Id: OTP-7604 Aux Id: seq11063

Improvements and New Features

The split function is now added to the re library. Exceptions and errors from both run, replace and split are made more consistent.

Own Id: OTP-7514 Aux Id: OTP-7494

Processes spawned using proc_lib (including gen_server and other library modules that use proc_lib) no longer keep the entire argument list for the initial call, but only the arity.

Also, if proc_lib:spawn/1 is used to spawn a fun, the actual fun is not kept, but only module, function name, and arity of the function that implements the fun.

The reason for the change is that keeping the initial fun (or a fun in an argument list), would prevent upgrading the code for the module. A secondary reason is that keeping the fun and function arguments could waste a significant amount of memory.

The drawback with the change is that the crash reports will provide less precise information about the initial call (only Module:Function/Arity instead of Module:Function(Arguments)). The function proc_lib:initial_call/1 still returns a list, but each argument has been replaced with a dummy atom.

Own Id: OTP-7531 Aux Id: seq11036

There is now experimental support for loading of code from archive files. See the documentation of code, init, erl_prim_loader and escript for more info.

The error handling of escripts has been improved.

An escript may now set explicit arguments to the emulator, such as -smp enabled.

An escript may now contain a precompiled beam file.

An escript may now contain an archive file containing one or more applications (experimental).

The internal module code_aux has been removed.

Own Id: OTP-7548 Aux Id: otp-6622

Enabled explicit control of which types of files that should be compressed in a ZIP archive.

Own Id: OTP-7549 Aux Id: otp-6622

In the job control mode, the "s" and "r" commands now take an optional argument to specify which shell to start. (Thanks to Robert Virding.)

Own Id: OTP-7617

STDLIB 1.15.4
Fixed Bugs and Malfunctions

A bug in the calendar module could cause calendar:local_time_to_universal_time_dst/1 to return duplicate identical values for local times in timezones without DST. Multiple values should only be returned when a local time is within the hour occurring twice due to shift from DST to non-DST, and certainly only in timezones with DST. The correct behaviour is now implemented.

Own Id: OTP-7344 Aux Id: seq10960

The documentation of (d)ets:init_table() has been corrected. (Thanks to Paul Mineiro.)

Own Id: OTP-7413

The soft upper limit of 60 on the number of non-white characters on a line, which was introduced in R12B-0 for the control sequences p and P of the functions io:fwrite/2,3 and io_lib:fwrite/2, has been removed. This means that terms whose printed representation fits on a line will have no NEWLINEs. The Erlang shell still uses the 60 character limit, though.

Own Id: OTP-7421 Aux Id: OTP-6708

Some debug code has been removed from Dets.

Own Id: OTP-7424

The documentation of dets:match_delete/2 has been corrected. (Thanks to Paul Mineiro.)

Own Id: OTP-7445

Corrections of digraph(3). (Thanks to Vlad Dumitrescu.)

Own Id: OTP-7492

For the process that an escript runs in, the trap_exit process flag is now false instead of true (as in previous releases). Scripts that depend on the previous (counter-intuitive) behaviour might not work. (Thanks to Bengt Kleberg.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-7517

Improvements and New Features

The documentation of lists:(u)sort/2 now states what is expected of an ordering function.

Own Id: OTP-7489

The re module is extended with repetitive matches (global option) and replacement function.

Own Id: OTP-7494 Aux Id: OTP-7181

The Erlang shell now displays a nicer error message when evaluating an undefined command. (Thanks to Richard Carlsson.)

Own Id: OTP-7495

STDLIB 1.15.3
Fixed Bugs and Malfunctions

zip:unzip to/from binary with empty directories did not work. (Thanks to Martin Dvorak.)

Own Id: OTP-7248

The documentation of the control sequence w of the io_lib module now states that floating point numbers are printed accurately.

Own Id: OTP-7324 Aux Id: OTP-7084

zip:unzip was not supporting a flavour of the zip format found in jar-files.

Own Id: OTP-7382 Aux Id: seq10970

Improvements and New Features

An experimental module "re" is added to the emulator which interfaces a publicly available regular expression library for Perl-like regular expressions (PCRE). The interface is purely experimental and *will* be subject to change.

The implementation is for reference and testing in connection to the relevant EEP.

Own Id: OTP-7181

STDLIB 1.15.2
Fixed Bugs and Malfunctions

When inserting many small objects, Dets sometimes crashed when reaching the maximum number of slots. (Thanks to Daniel Goertzen.)

Own Id: OTP-7146

Processes linked to the Erlang shell did not get an exit signal when the evaluator process was killed. This bug, introduced in R12B-0, has been fixed.

Own Id: OTP-7184 Aux Id: OTP-6554

Invalid arguments to ets:update_counter/3 were not handled correctly. A tuple position (Pos) less than 1 caused the element directly following the key to be updated (as if no position at all had been specified). All invalid values for Pos will now fail with badarg.

Own Id: OTP-7226

For certain terminals, io:columns/0 could return 0 instead of enotsup. That is now corrected.

Own Id: OTP-7229 Aux Id: seq10886

qlc:info() can now handle port identifiers, pids, references, and funs. (Thanks to Wojciech Kaczmare for reporting this bug.)

When evaluating the parent_fun messages sent to the process calling qlc:cursor() were sometimes erroneously consumed. This bug has been fixed.

Own Id: OTP-7232

erl_parse:abstract() can now handle bit strings.

Own Id: OTP-7234

Improvements and New Features

The queue module has been rewritten to make it easier to use. Suggestions and discussion from and with among others Lev Walkin, Anders Ramsell and Rober Virding in december 2007 on erlang-questions@erlang.org. It was also discussed to change the internal representation to contain length information which would speed up len/1 but that change has been postponed. Anyone interested may write an EEP and try to reach an acceptable compromise for queue overhead and thereby the speed of all other operations than len/1. The queue module is now optimized for fast and minimal garbage in/2 and out/1 and such. See the documentation.

New functions: is_queue/1, get/1, get_r/1, peek/1, peek_r/1, drop/1, drop_r/1 and liat/1. is_queue/1 is a new predicate, liat/1 is a correction of an old misspelling, and the others (get*, peek* and drop*) are new interface functions.

Own Id: OTP-7064

The functions io_lib:write/1,2 and io_lib:print/1,4 have been changed when it comes to writing floating point numbers. This change affects the control sequences p, P, w, and W of the io_lib module. (Thanks to Bob Ippolito for code contribution.)

Own Id: OTP-7084

Updated the documentation for erlang:function_exported/3 and io:format/2 functions to no longer state that those functions are kept mainly for backwards compatibility.

Own Id: OTP-7186

A new BIF ets:update_element/3. To update individual elements within an ets-tuple, without having to read, update and write back the entire tuple.

Own Id: OTP-7200

string:join/2 now accepts an empty list as first argument.

Own Id: OTP-7231 Aux Id: OTP-6671

qlc:info/1,2 accepts a new option, depth. The type SelectedObjects used in the description of qlc:table/2 has been augmented.

Own Id: OTP-7238

tuple_size/1 and byte_size/1 have been substituted for size/1 in the documentation.

Own Id: OTP-7244

STDLIB 1.15.1
Fixed Bugs and Malfunctions

Ets:select/3 in combination with ets:repair_continuation/2 and ordered_set data tables could result in function_clause although used as intended. This is now corrected. Thanks to Paul Mineiro for finding and isolating the bug!

Own Id: OTP-7025

The compiler warning for the deprecated function ftp:close/1 now mentions the correct replacement function.

The warning for the removed functions in the httpd_util module have been changed to say they have been removed, not merely deprecated. (Thanks to Fredrik Thulin.)

Own Id: OTP-7034 Aux Id: seq10825

In (Expr)#r{} (no fields are updated), Expr is no longer evaluated more than once. There is also a test that Expr is of the correct record type. (Thanks to Dominic Williams.)

Own Id: OTP-7078 Aux Id: OTP-4962

Documentation bugfixes and clarifications.

(Thanks to Joern (opendev@gmail.com), Matthias Lang, and Richard Carlsson.)

Own Id: OTP-7079

Duplicated objects were sometimes not deleted from the list of answers when a QLC table was traversed using a match specification. (Thanks to Dmitri Girenko.)

Own Id: OTP-7114

Improvements and New Features

The documentation has been updated so as to reflect the last updates of the Erlang shell as well as the minor modifications of the control sequence p of the io_lib module.

Superfluous empty lines have been removed from code examples and from Erlang shell examples.

Own Id: OTP-6944 Aux Id: OTP-6554, OTP-6911

tuple_size/1 and byte_size/1 have been substituted for size/1.

Own Id: OTP-7009

It is now possible to hibernate a gen_server/gen_event/gen_fsm. In gen_server and gen_fsm, hibernation is triggered by returning the atom 'hibernate' instead of a timeout value. In the gen_event case hibernation is triggered by a event handler returning a tuple with an extra element containing the atom 'hibernate'.

Own Id: OTP-7026 Aux Id: seq10817

Some undocumented debug functionality has been added to Dets.

Own Id: OTP-7066

The functions digraph_utils:is_tree/1, digraph_utils:is_arborescence/1, and digraph_utils:arborescence_root/1 are new.

Own Id: OTP-7081

The compiler could generate suboptimal code for record updates if the record update code consisted of multiple source code lines.

Own Id: OTP-7101

STDLIB 1.15
Fixed Bugs and Malfunctions

Bugs have been fixed in qlc:

Setting the lookup_fun option of qlc:table/2 to undefined could cause a crash. If a QLC restricted some column of a table in such a way that a traversal using a match specification was possible and the QLC also compared the key column or some indexed column of the the table with a column of some other table, qlc always chose to traverse the table first, never considering lookup join. This has been changed so that lookup join is always preferred; if an initial traversal using the match specification is desired, the query needs to be rewritten introducing an extra QLC with the filter(s) restricting the column. When trying to find candidates for match specifications and lookup, filters using variables from one generator only are ignored unless they are placed immediately after the generator and possibly other filters using variables from the same generator. In particular, filters joining two tables should not be placed between the generator and the filters using the generator only. The call-back function TraverseFun used for implementing QLC tables is allowed to return a term other than a list since STDLIB 1.14 (OTP-5195). However, when the returned term was a fun qlc often tried to call the fun instead of returning it.

A few minor optimizations have been implemented as well.

Own Id: OTP-6673

A bug concerning the use of parameterized modules from the shell has been fixed.

Own Id: OTP-6785

A bug regarding the size expression of the bit syntax has been fixed in the erl_eval module.

Own Id: OTP-6787

The log_mf_h event handler didn't close the index file when it was done reading it causing a file descriptor leak.

Own Id: OTP-6800

Definitions for the filename() and dirname() types have been added to the documentation for the filelib module.

Own Id: OTP-6870

file:write_file/3, file:write/2 and file:read/2 could crash (contrary to documentation) for odd enough file system problems, e.g write to full file system. This bug has now been corrected.

In this process the file module has been rewritten to produce better error codes. Posix error codes now originate from the OS file system calls or are generated only for very similar causes (for example 'enomem' is generated if a memory allocation fails, and 'einval' is generated if the file handle in Erlang is a file handle but currently invalid).

More Erlang-ish error codes are now generated. For example {error,badarg} is now returned from file:close/1 if the argument is not of a file handle type. See file(3).

The possibility to write a single byte using file:write/2 instead of a list or binary of one byte, contradictory to the documentation, has been removed.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6967 Aux Id: OTP-6597 OTP-6291

A bug concerning the evaluation of the ++/2 operator has been fixed in erl_eval. (Thanks to Matthew Dempsky.)

Own Id: OTP-6977

Improvements and New Features

The behaviour of the internal functions gen:call/3,4 has been changed slightly in the rare case that when the caller was linked to the called server, and the server crashed during the call; its exit signal was consumed by the gen:call/3,4 code and converted to an exit exception. This exit signal is no longer consumed.

To even notice this change, 1) the calling process has to be linked to the called server.

2) the call must not be remote by name that is it must be local or remote by pid, local by name or global by name.

3) the calling process has to have set process_flag(trap_exit, true).

4) the server has to crash during the call.

5) the calling process has to be sensitive to getting previously consumed {'EXIT',Pid,Reason} messages in its message queue.

The old behaviour was once the only way for a client to notice if the server died, but has since erlang:monitor(process, {Name,Node}) was introduced and used in gen:call been regarded as an undesired behaviour if not a bug.

The affected user APIs are: gen_server:call/2,3, gen_fsm:sync_send_event/2,3, gen_fsm:sync_send_all_state_event/2,3, gen_event:_, sys:_ and maybe a few others that hardly will be noticed.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-3954 Aux Id: Seq 4538

When an exception occurs the Erlang shell now displays the class, the reason, and the stacktrace in a clearer way (rather than dumping the raw EXIT tuples as before). proc_lib:format/1 displays the exception of crash reports in the same clearer way.

The new shell command catch_exception and the new application configuration parameter shell_catch_exception can be used for catching exceptions that would normally exit the Erlang shell.

Own Id: OTP-6554 Aux Id: OTP-6289

The function string:join/2 joins strings in a list with a separator. Example: 'string:join(["a", "b", "c"], ", ") gives "a, b, c"'

Own Id: OTP-6671

The control sequence P of the Format argument of the functions io:fwrite/2,3 and io_lib:fwrite/2 now inserts fewer line breaks when printing tuples and lists. A soft upper limit of 60 on the number of non-white characters on a line has been introduced.

Own Id: OTP-6708

The new module array provides a fast functional array implementation.

Own Id: OTP-6733

Functions that have long been deprecated have now been removed from the following modules: dict, erl_eval, erl_pp, io, io_lib, lists, orddict, ordsets, sets, and string.

The undocumented function lists:zf/3 has also been removed (use a list comprehension or lists:zf/2 instead).

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6845

Minor documentation corrections for file:pread/2 and file:pread/3.

Own Id: OTP-6853

Contract directives for modules in Kernel and STDLIB.

Own Id: OTP-6895

The ets:fixtable/2 function, which has been deprecated for several releases, has been removed.

The ets:info/1 function has been reimplemented as a BIF, which guarantees that information returned is consistent.

The ets:info/2 function now fails with reason badarg if the second argument is invalid. (Dialyzer can be used to find buggy code where the second argument is misspelled.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6906

The Erlang pretty printer erl_pp now inserts more newlines in order to facilitate line coverage analysis by Cover. (Thanks to Thomas Arts.)

Own Id: OTP-6911

The documentation for ets:safe_fixtable/2, ets:foldl/3, and ets:foldr/3 is now clearer about what will happen if objects are inserted during table traversals.

Own Id: OTP-6928 Aux Id: seq10779

It is now possible to extract files in tar files directly into binaries. It is also possible to add files to tar files directly from binaries.

Own Id: OTP-6943

The functions keystore/4 and keytake/3 are new in the lists module.

Own Id: OTP-6953

The new qlc option tmpdir_usage can be used for outputting messages onto the error logger when a temporary file is about to be created, or to prohibit the usage of temporary files altogether.

Own Id: OTP-6964

STDLIB 1.14.5.3
Improvements and New Features

The allowed syntax for -type() and -spec() was updated.

Own Id: OTP-6861 Aux Id: OTP-6834

STDLIB 1.14.5.2
Improvements and New Features

The compiler will for forward compatibility ignore the -type() and -spec() attributes that will be introduced in the R12B release.

Own Id: OTP-6834

STDLIB 1.14.5.1
Fixed Bugs and Malfunctions

The log_mf_h event handler didn't close the index file when it was done reading it causing a file descriptor leak.

Own Id: OTP-6800

Improvements and New Features

The dict:size/1 and orddict:size/1 functions have been documented.

Own Id: OTP-6818

STDLIB 1.14.5
Fixed Bugs and Malfunctions

Bugs have been fixed in Dets concerning comparison (==) and matching (=:=).

The STDLIB manual pages have been updated as to more carefully state when terms are matched and when they are compared.

Own Id: OTP-4738 Aux Id: OTP-4685

The shell has been updated to fix the following flaws: Shell process exit left you with an unresponsive initial shell if not using oldshell. Starting a restricted shell with a nonexisting callback module resulted in a shell where no commands could be used, not even init:stop/0. Fun's could not be used as parameters to local shell functions (in shell_default or user_default) when restricted_shell was active.

Own Id: OTP-6537

A bug in QLC's parse transform has been fixed.

Own Id: OTP-6590

A bug concerning lists:sort/1 and lists:keysort/2 and a mix of floating point numbers and integers has been fixed.

Own Id: OTP-6606

When calling erlang:garbage_collect/0 in the Erlang shell not only the evaluator process (the one returned by calling self() in the Erlang shell) is garbage collected, but also the process holding the history list.

Own Id: OTP-6659

Functions of the beam_lib module that used to catch exceptions and return a tuple {'EXIT',Reason} now exit with the reason Reason.

Own Id: OTP-6711

The erl_eval module now calls the non-local function handler whenever an operator is evaluated (exceptions are andalso, orelse, and catch). The non-local function handler is now also called when the function or operator occurs in a guard test (such calls used to be ignored).

These changes affect the Erlang shell when running in restricted mode: the callback function non_local_allowed/3 is now called for operators such as '!'/2. This means that non_local_allowed/3 may need to be changed as to let operators through. Note that erlang:'!'/2 as well as erlang:send/2,3 have to be restricted in order to stop message passing in the shell.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6714 Aux Id: seq10374

Improvements and New Features

The new compiler option warn_obsolete_guard can be used for turning on warnings for calls to old type testing BIFs.

Own Id: OTP-6585

For scripts written using escript, there is a new function escript:script_name/0, which can be used to retrieve the pathame of the script. The documentation has been clarified regarding pre-defined macros such as ?MODULE and the module name.

Own Id: OTP-6593

Minor Makefile changes.

Own Id: OTP-6689 Aux Id: OTP-6742

STDLIB 1.14.4
Fixed Bugs and Malfunctions

The MD5 calculation of a BEAM file done by code:module_md5/1, beam_lib:md5/1, and by the compiler for the default value of the vsn attribute have all been changed so that its result will be the same on all platforms; modules containing funs could get different MD5s on different platforms.

Own Id: OTP-6459

When sorting terms using the file_sorter module (the option Format set to term), file errors were not always properly handled. This bug has been fixed.

The directory supplied with the tmpdir option is no longer checked unless it is actually used. The error reason not_a_directory can no longer be returned; instead a file_error tuple is returned

Own Id: OTP-6526

Bugs regarding try/catch have been fixed in the erl_eval module.

Own Id: OTP-6539

When sorting the operands of a join operation, QLC called file:open/3 with bad arguments. This bug has been fixed.

Own Id: OTP-6562 Aux Id: seq10606

Improvements and New Features

The functions beam_lib:cmp/1 and beam_lib:strip/1 (and similar functions) have been updated to handle optional chunks (such as "FunT") in more general way in order to be future compatible.

The function beam_lib:chunks/3 has been added.

The function beam_lib:md5/1 has been added.

Own Id: OTP-6443

Added base64 as a module to stdlib, encoding and decoding

Own Id: OTP-6470

Added the functions to_upper/1 and to_lower/1 to the string module. These provide case conversion for ISO/IEC 8859-1 characters (Latin1) and strings.

Own Id: OTP-6472

The callback function non_local_allowed/3 used by the restricted shell can now return the value {{restricted,NewFuncSpec,NewArgList},NewState} which can be used for letting the shell call some other function than the one specified.

Own Id: OTP-6497 Aux Id: seq10555

There is a new escript program that can be used for writing scripts in Erlang. Erlang scripts don't need to be compiled and any arguments can be passed to them without risk that they are interpreted by the Erlang system.

Own Id: OTP-6505

The Format argument of the functions io:fwrite/2,3 and io_lib:fwrite/2 is now allowed to be a binary.

Own Id: OTP-6517

STDLIB 1.14.3.1
Fixed Bugs and Malfunctions

The control sequences p and P of the Format argument of the functions io:fwrite/2,3 and io_lib:fwrite/2 could cause a badarg failure when applied to binaries. This bug was introduced in STDLIB 1.14.3. (Thanks to Denis Bilenko.)

Own Id: OTP-6495

Improvements and New Features

Added the option {cwd, Dir} to make zip-archives with relative pathnames without having to do (a global) file:set_cwd.

Own Id: OTP-6491 Aux Id: seq10551

STDLIB 1.14.3
Fixed Bugs and Malfunctions

The spawn_opt/2,3,4,5 option monitor -- introduced in Kernel 2.11.2 -- is currently not possible to use when starting a process using proc_lib, that is, also when starting a gen_server, gen_fsm etc.

This limitation has now been properly documented and the behavior of the gen_fsm, gen_server, and proc_libstart and start_link functions when providing this option has been changed from hanging indefinitely to failing with reason badarg.

(Thanks to Fredrik Linder)

Own Id: OTP-6345

Improvements and New Features

The control sequence P of the Format argument of the functions io:fwrite/2,3 and io_lib:fwrite/2 now replaces the tail of binary strings with ... when the maximum depth has been reached. For instance, >, 3]).]]> prints >]]>.

The indentation takes more care not to exceed the right margin, if possible.

If the maximum depth is reached while printing a tuple, ,... is printed instead of |... (this change applies to the control sequence W as well).

Own Id: OTP-6354

The Erlang shell command h/0 that prints the history list now avoids printing (huge) terms referred to by v/1 but instead just prints the call to v/1.

Own Id: OTP-6390

STDLIB 1.14.2.2
Fixed Bugs and Malfunctions

The functions dets:select/1,3, dets:match/1,3, and dets:match_object/1,3 have been changed as to never return {[],Continuation}. This change affects the corresponding functions in Mnesia.

Bugs have been fixed in QLC: qlc:info() could crash if the tmpdir option did not designate a valid directory; the results of looking up keys are kept in RAM, which should improve performance.

Own Id: OTP-6359

STDLIB 1.14.2.1
Fixed Bugs and Malfunctions

A bug in erl_pp:exprs() has been fixed.

Own Id: OTP-6321 Aux Id: seq10497

STDLIB 1.14.2
Fixed Bugs and Malfunctions

The control sequences p and P of the Format argument of the functions io:format/2,3 and io_lib:format/2 did not handle binaries very well. This bug, introduced in stdlib-1.14, has been fixed.

Own Id: OTP-6230

filelib:wildcard(Wc, PathWithRedundantSlashes), where PathWithRedundantSlashes is a directory path containing redundant slashes, such as /tmp/ or //tmp, could return incorrect results. (Thanks to Martin Bjorklund.)

Own Id: OTP-6271

The Erlang code preprocessor crashed if the predefined macros ?MODULE or ?MODULE_STRING were used before the module declaration. This bug has been fixed.

Own Id: OTP-6277

Improvements and New Features

Support for faster join of two tables has been added to the qlc module. There are two kinds of fast joins: lookup join that uses existing indices, and merge join that takes two sorted inputs. There is a new join option that can be used to force QLC to use a particular kind of join in some QLC expression.

Several other changes have also been included:

The new tmpdir option of cursor/2, eval/2, fold/4, and info/2 can be used to set the directory that join uses for temporary files. The option also overrides the tmpdir option of keysort/3 and sort/2.

The new lookup option can be used to assert that constants are looked up when evaluating some QLC expression.

The cache and cache_all options accept new tags: ets, list, and no. The tag list caches answers in a list using a temporary file if the answers cannot be held in RAM. Combining {cache,list} and {unique, true} is equivalent to calling sort/2 with the option unique set to true. The old tags true (equivalent to ets) and false (equivalent to no) are recognized for backward compatibility.

The new option max_list_size can be used to set the limit where merge join starts to use temporary files for large equivalence classes and when answers cached in lists are put on temporary files.

There is a new callback is_sorted_key to be supplied as an option to table/2.

QLC analyzes each and every QLC expression when trying to find constants for the lookup function. Hitherto only QLC expressions with exactly one generator were analyzed.

Note that only filters with guard syntax placed immediately after the generator are analyzed. The restriction to guard filters is an incompatible change. See qlc(3) for further details.

In a similar way several match specifications for traversal of QLC tables can be utilized for different generators of one single QLC expression.

A bug has been fixed: when caching answers to a sufficiently complex query it could happen that some answers were not returned.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6038

The Erlang pretty printer (erl_pp) is now much faster when the code is deeply nested. A few minor bugs have been fixed as well.

Own Id: OTP-6227 Aux Id: OTP-5924

The Erlang shell now tries to garbage collect large binaries. Under certain circumstances such binaries could otherwise linger on for an indefinite amount of time.

Own Id: OTP-6239

To help Dialyzer find more bugs, many functions in the Kernel and STDLIB applications now only accept arguments of the type that is documented.

For instance, the functions lists:prefix/2 and lists:suffix/2 are documented to only accept lists as their arguments, but they actually accepted anything and returned false. That has been changed so that the functions cause an exception if one or both arguments are not lists.

Also, the string:strip/3 function is documented to take a character argument that is a character to strip from one or both ends of the string. Given a list instead of a character, it used to do nothing, but will now cause an exception.

Dialyzer will find most cases where those functions are passed arguments of the wrong type.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6295

STDLIB 1.14.1
Fixed Bugs and Malfunctions

The functions c:y/1,2 which call yecc:file/1,2 are now listed by c:help/0.

Documentation of c:y/1,2 has been added to c(3).

The fact that the control sequence character s recognizes binaries and deep character lists has been documented in io(3). This feature was added in R11B-0 (OTP-5403).

Own Id: OTP-6140

The shell command rr() sometimes failed to read record definitions from file(s). This problem has been fixed.

Own Id: OTP-6166 Aux Id: OTP-5878

The nonlocal function handler in erl_eval, which is used for implementing the restricted mode of the Erlang shell, did not handle calls to erlang:apply/3 correctly. This bug has been fixed.

Own Id: OTP-6169 Aux Id: seq10374

ets:rename/1 could deadlock, or crash the SMP emulator when the table wasn't a named table.

ets:next/2, and ets:prev/2 could return erroneous results on the SMP emulator.

Own Id: OTP-6198 Aux Id: seq10392, seq10415

When closing a Dets table the space management data was sometimes saved in such a way that opening the table could not be done without repairing the file. This bug has been fixed.

Own Id: OTP-6206

STDLIB 1.14
Fixed Bugs and Malfunctions

A bugfix in QLC: two of the call-back functions used for implementing QLC tables, TraverseFun and LookupFun, are now allowed to return a term other than a list. Such a term is immediately returned as the results of the current query, and is useful mostly for returning error tuples.

Several other minor bugs have been also been fixed.

Own Id: OTP-5195

The STDLIB modules error_logger_file_h and error_logger_tty_h now read the environment variable utc_log from the SASL application.

Own Id: OTP-5535

ets:info/1 has been corrected to behave according to the documentation and return a list of tuples, not a tuple with tuples.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-5639

Referencing a so far undeclared record from the default value of some record declaration is from now on considered an error by the linter. It is also an error if the default value of a record declaration uses or binds a variable.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-5878

When a file .hrl file is included using -include_lib, the include path is temporarily updated to include the directory the .hrl file was found in, which will allow that .hrl file to itself include files from the same directory as itself using -include. (Thanks to Richard Carlsson.)

Own Id: OTP-5944

Corrected filelib:ensure_dir/1 which sometimes returned true and sometimes ok to always return ok when successful. This goes against the documentation which said true, but ok was judged to be a more logical return value.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-5960 Aux Id: seq10240

The shell now handles records better when used in calls on the form {Module, Function}(ArgList).

Own Id: OTP-5990 Aux Id: OTP-5876

The functions lists:ukeysort/2 and lists:ukeymerge/3 have been changed in such a way that two tuples are considered equal if their keys match.

For the sake of consistency, lists:usort/2 and lists:umerge/3 have been modified too: two elements are considered equal if they compare equal.

The file_sorter module has been modified in a similar way: the unique option now applies to the key (keysort() and keymerge()) and the ordering function (the option {order, Order} ).

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-6019

Correction in documentation for ets:update_counter/3; failure with badarg also if the counter to be updated is the key.

Own Id: OTP-6072

When sorting terms using the file_sorter module and an ordering fun, the sort was not always stable. This bug has been fixed.

Own Id: OTP-6088

Improvements and New Features

Improvements of the linter:

The compile attribute is recognized after function definitions.

The new compiler option nowarn_deprecated_function can be used for turning off warnings for calls to deprecated functions.

The new compiler option {nowarn_unused_function,[{Name,Arity}]} turns off warnings for unused local functions for the mentioned functions. The new options {nowarn_deprecated_function,[{Module,Name,Arity}]} and {nowarn_bif_clash,[{Name,Arity}]} work similarly.

The Erlang code preprocessor epp now recognizes the file attribute. This attribute is meant to be used by tools such as Yecc that generate source code files.

Own Id: OTP-5362

The formatting option ~s of io:fwrite and io_lib:fwrite has been extended to handle arguments that are binaries or I/O lists.

Own Id: OTP-5403

The control sequences p and P of the Format argument of the functions io:format/2,3 and io_lib:format/2 have been changed as to display the contents of binaries containing printable characters as strings.

Own Id: OTP-5485

The linter emits warnings for functions exported more than once in export attributes.

Own Id: OTP-5494

A manual for STDLIB has been added, stdlib(6). It mentions the configuration parameters for the Erlang shell.

Own Id: OTP-5530

Added the zip module with functions for reading and creating zip archives. See zip(3).

Own Id: OTP-5786

Simple-one-for-one supervisors now store the pids of child processes using dict instead of a list. This significantly improves performance when there are many dynamic supervised child processes. (Thanks to Mickaël Rémond et al.)

Own Id: OTP-5898

When given the new option 'strict_record_tests', the compiler will generate code that verifies the record type for 'R#record.field' operations in guards. Code that verifies record types in bodies has already been generated since R10B, but in this release there will be a '{badrecord,RecordTag}' instead of a 'badmatch' if the record verification test fails. See the documentation for the compile module for more information.

The Erlang shell always applies strict record tests.

Own Id: OTP-5915 Aux Id: OTP-5714

The Erlang pretty printer (erl_pp) now tries to insert line breaks at appropriate places.

Own Id: OTP-5924

The public option has been removed from digraph:new/1. The reason is that several functions in the digraph module are implemented using multiple ETS accesses, which is not thread safe. (Thanks to Ulf Wiger.)

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-5985

The function lists:keyreplace/4 checks that the fourth argument (NewTuple) is a tuple.

Own Id: OTP-6023

Added an example of how to reconstruct source code from debug info (abstract code) to beam_lib(3). (Thanks to Mats Cronqvist who wrote the example.)

Own Id: OTP-6073

The new compiler option warn_unused_record is used for finding unused locally defined record types.

Own Id: OTP-6105

STDLIB 1.13.12
Fixed Bugs and Malfunctions

shell_default:xm/1 has been added. It calls xref:m/1.

Own Id: OTP-5405 Aux Id: OTP-4101

Warnings are output whenever so far undeclared records are referenced from some default value of a record declaration. In STDLIB 1.14 (R11B) such forward references will cause a compilation error.

Own Id: OTP-5878

The linter's check of the deprecated attribute did not take the compile option export_all into account. This bug has been fixed.

Own Id: OTP-5917

The Erlang pretty printer did not handle try/catch correctly. This bug has been fixed.

Own Id: OTP-5926

Corrected documentation for lists:nthtail/3.

Added documentation for lists:keymap/3.

Tried to clarify some other type declarations and function descriptions in lists(3).

Corrected documentation for timer:now_diff/2.

Fixed broken links in gen_fsm(3), gen_server(3), io_lib(3) and lib(3).

Own Id: OTP-5931

Type checks have been added to functions in lists.erl.

Own Id: OTP-5939

Improvements and New Features

The new STDLIB module erl_expand_records expands records in abstract code. It is used by the Erlang shell, which means that Compiler is no longer used by the shell.

Own Id: OTP-5876 Aux Id: OTP-5435

The compiler will now warn that the megaco:format_versions/1 function is deprecated.

Own Id: OTP-5976

STDLIB 1.13.11
Fixed Bugs and Malfunctions

When calling gen_server:enter_loop with a registered server name, it was only checked that the registered name existed, not that it actually was the name of the calling process.

Own Id: OTP-5854

Improvements and New Features

More detail on beam_lib:version/1 in documentation.

Own Id: OTP-5789

The new function io:read/3 works like io:read/1,2 but takes a third argument, StartLine.

Own Id: OTP-5813

The new function gen_fsm:enter_loop/4,5,6, similar to gen_server:enter_loop/3,4,5, has been added.

Own Id: OTP-5846 Aux Id: seq10163

The function c:i/1 is now exported.

Own Id: OTP-5848 Aux Id: seq10164

STDLIB 1.13.10
Fixed Bugs and Malfunctions

A couple of type errors have been fixed in sofs.

Own Id: OTP-5739

The pre-processor used to complain that the macro definition '-define(S(S), ??S).' was circular, which it isn't. (Thanks to Richard Carlsson.)

Own Id: OTP-5777

STDLIB 1.13.9
Fixed Bugs and Malfunctions

The linter, QLC and the module erl_pp did not handle the new 'fun M:F/A' construct in all situations. This problem has been fixed.

Own Id: OTP-5644

Improvements and New Features

The manual pages for most of the Kernel and some of the STDLIB modules have been updated, in particular regarding type definitions.

The documentation of the return value for erts:info/1 has been corrected.

The documentation for erlang:statistics/1 now lists all possible arguments.

Own Id: OTP-5360

Replaced some tuple funs with the new fun M:F/A construct.

The high-order functions in the lists module no longer accept bad funs under any circumstances. 'lists:map(bad_fun, [])' used to return '[]' but now causes an exception.

Unused, broken compatibility code in the ets module was removed. (Thanks to Dialyzer.)

Eliminated 5 discrepancies found by Dialyzer in the Appmon application.

Own Id: OTP-5633

The c:i/0 function will now run in a paged mode if there are more than 100 processes in the system. (Thanks to Ulf Wiger.)

erlang:system_info(process_count) has been optimized and does now return exactly the same value as length(processes()). Previously erlang:system_info(process_count) did not include exiting processes which are included in length(processes()).

The +P flag for erl, which sets the maximum number of processes allowed to exist at the same, no longer accepts values higher than 134217727. (You will still probably run out of memory before you'll be able to reach that limit.)

Own Id: OTP-5645 Aux Id: seq9984

STDLIB 1.13.8
Fixed Bugs and Malfunctions

Very minor corrections in beam_lib and its documentation.

Own Id: OTP-5589

Improvements and New Features

The erlang:port_info/1 BIF is now documented. Minor corrections of the documentation for erlang:port_info/2.

Added a note to the documentation of the math module that all functions are not available on all platforms.

Added more information about the '+c' option in the erl man page in the ERTS documentation.

Own Id: OTP-5555

The new fun M:F/A construct creates a fun that refers to the latest version of M:F/A. This syntax is meant to replace tuple funs {M,F} which have many problems.

The new type test is_function(Fun,A) (which may be used in guards) test whether Fun is a fun that can be applied with A arguments. (Currently, Fun can also be a tuple fun.)

Own Id: OTP-5584

STDLIB 1.13.7
Fixed Bugs and Malfunctions

filelib:wildcard/2 was broken (it ignored its second argument).

Also, filelib:wildcard("Filename") (where the argument does not contain any meta-characters) would always return ["Filename"]. Corrected so that an empty list will be returned if "Filename" does not actually exist. (Same correction in filelib:wildcard/2.) (This change is a slight incompatibility.)

filelib:wildcard/1,2 will generate a different exception when given bad patterns such as "{a,". The exception used to be caused by 'exit(missing_delimiter)' but is now 'erlang:error({badpattern,missing_delimiter})'.

Own Id: OTP-5523 Aux Id: seq9824

Improvements and New Features

Further improvements of encrypted debug info: New option encrypt_debug_info for compiler.

Own Id: OTP-5541 Aux Id: seq9837

STDLIB 1.13.6
Fixed Bugs and Malfunctions

When opening a Dets table read only an attempt was sometimes made to re-hash the table resulting in an error message. This problem has been fixed.

Own Id: OTP-5487 Aux Id: OTP-4989

Improvements and New Features

It is now possible to encrypt the debug information in Beam files, to help keep the source code secret. See the documentation for compile on how to provide the key for encrypting, and the documentation for beam_lib on how to provide the key for decryption so that tools such as the Debugger, xref, or cover can be used.

The beam_lib:chunks/2 functions now accepts an additional chunk type compile_info to retrieve the compilation information directly as a term. (Thanks to Tobias Lindahl.)

Own Id: OTP-5460 Aux Id: seq9787

STDLIB 1.13.5
Fixed Bugs and Malfunctions

Closing a Dets table kept in RAM would cause a crash if the file could not be written. This problem has been fixed by returning an error tuple.

Own Id: OTP-5402

erl_pp now correctly pretty-prints fun F/A.

Own Id: OTP-5412

The Erlang shell failed if the compiler was not in the code path. This problem has been fixed, but in order to evaluate records the compiler is still needed.

Own Id: OTP-5435

Corrected the example in the documentation for ets:match/2. Also clarified that ets:update_counter/3 updates the counter atomically. (Thanks to Anders Svensson.)

Own Id: OTP-5452 Aux Id: seq9770, seq9789

Improvements and New Features

The possibility to start the Erlang shell in parallel with the rest of the system was reintroduced for backwards compatibility in STDLIB 1.13.1. The flag to be used for this is now called async_shell_start and has been documented. New shells started from the JCL menu are not synchronized with init anymore. This makes it possible to start a new shell (e.g. for debugging purposes) even if the initial shell has not come up.

Own Id: OTP-5406 Aux Id: OTP-5218

The compiler will now produce warnings when using the deprecated functions in the snmp module.

Own Id: OTP-5425

The function c:zi/0 has been removed. Use c:i/0 instead.

Own Id: OTP-5432

Corrected two minor bugs found by the Dialyzer: Calling a parameterized module from a restricted shell (i.e. if shell:start_restricted/1 has been used) would crash the shell evaluator. A debug printout in gen_fsm had a clause that would never match; causing less information to be printed.

And a somewhat more serious one also found by Dialyzer: rpc:yield/1 would crash unless the call started by rpc:async_call/4 had already finished; rpc:nb_yield(Key,infinity) would also crash.

Cleaned up and removed redundant code found by Dialyzer in erlang:dmonitor_p/2.

Own Id: OTP-5462

STDLIB 1.13.4
Fixed Bugs and Malfunctions

Bugs in the Erlang shell have been fixed.

Own Id: OTP-5327

Some dead code reported by Dialyzer was eliminated.

A bug in dbg when tracing to wrap trace files has been corrected. It failed to delete any already existing wrap trace files with the same names when starting a new wrap trace.

Own Id: OTP-5329

The linter could output invalid warnings about bit patterns in record initializations. This problem has been fixed.

Own Id: OTP-5338

ordsets:is_set(NoList), where NoList is any term except a list, would crash. For consistency with sets:is_set/1 and gb_sets:is_set/1, it now returns false.

Own Id: OTP-5341

A BIF erlang:raise/3 has been added. See the manual for details. It is intended for internal system programming only, advanced error handling.

Own Id: OTP-5376 Aux Id: OTP-5257

Improvements and New Features

The deprecated attribute is now checked by the linter. See xref(3) for a description of the deprecated attribute.

Own Id: OTP-5276

The restricted shell will now indicate if the return value from a user predicate is on an incorrect form.

Own Id: OTP-5335

STDLIB 1.13.3
Fixed Bugs and Malfunctions

Bugs concerning unused and shadowed variables have been fixed in the linter.

Own Id: OTP-5091

A bug in the evaluator that caused the shell to choke on bit syntax expressions has been fixed.

Own Id: OTP-5237

io:format/2 et.al no longer crashes for some combinations of precision and value for format character "g". Previously it crashed if the precision P was 4 or lower and the absolute value of the float to print was lower than 10^4 but 10^(P-1) or higher. Now it will not crash depending on the value of the float.

Own Id: OTP-5263

Bugs in the handling of the bit syntax have been fixed in the Erlang shell.

Own Id: OTP-5269

gb_sets:del_element/2 was changed to do the same as gb_sets:delete_any/2 which was the original intention, not as gb_sets:delete/2. Code that relies on gb_sets:del_element/2 causing an error if the element does not exist must be changed to call gb_sets:delete/2 instead.

The documentation was also updated to explicitly document functions that were only referred to as 'aliases' of a documented function. Also, a list of all functions common to the gb_sets, sets, and ordsets was added.

*** POTENTIAL INCOMPATIBILITY ***

Own Id: OTP-5277

Debug messages have been removed from the QLC module.

Own Id: OTP-5283

Improvements and New Features

The size of continuations returned from dets:match/1,3, dets:match_object/1,3, and dets:select/1,3 has been reduced. This affects the amount of data Mnesia sends between nodes while evaluating QLC queries.

Own Id: OTP-5232

STDLIB 1.13.2
Improvements and New Features

The -rsh switch for starting a remote shell (introduced with OTP-5210) clashed with an already existing switch used by slave. Therefore the switch for the remote shell is now instead named -remsh.

Own Id: OTP-5248 Aux Id: OTP-5210

STDLIB 1.13.1
Fixed Bugs and Malfunctions

The Pman 'trace shell' functionality was broken as has now been fixed. Furthermore, Pman could not correctly find the pid of the active shell if more than one shell process was running on the node. This has also been corrected.

Own Id: OTP-5191

When the undocumented feature "parameterized modules" was used, the ?MODULE macro did not work correctly.

Own Id: OTP-5224

Improvements and New Features

You can now start Erlang with the -rsh flag which gives you a remote initial shell instead of a local one. Example:

            erl -sname this_node -rsh other_node@other_host
          

Own Id: OTP-5210

The man page for the lists module has been updated with description of the new zip, unzip, and partition/2 functions.

Own Id: OTP-5213

The top level group leader used to be listed as job #1 in the job list in JCL mode. Since there is no shell associated with this process that can be connected to, it will no longer be listed.

Own Id: OTP-5214

The possibility to start the Erlang shell in parallel with the rest of the system has been reintroduced for backwards compatibility. Note that this old behaviour is error prone and should not be used unless for some reason necessary.

Own Id: OTP-5218 Aux Id: seq9534

The shell commands rr/1,2,3 now accepts wildcards when reading record definitions from BEAM files.

Own Id: OTP-5226