# Stdlib Release Notes

## Stdlib 1.12

### Fixed errors and malfunctions

- A bug in `sofs:partition/2` has been fixed.
  (Own Id: OTP-4516)

- Bugs concerning list comprehension and guards have been fixed in the Erlang interpreter.
  (Own Id: OTP-4518)

- `c:memory()` only reported half of the amount of `ets` memory allocated on 64-bit architectures. This bug has now been fixed.
  (Own Id: OTP-4519)

- If a naughty child process did unlink(Supervisor), and then the supervisor decides to terminate that child, it would hang forever. The supervisor now uses erlang:monitor instead of waiting for exit-signals, so that naughty child processes can not make a supervisor hang.
  (Own Id: OTP-4568)
  (Aux Id: seq3601)

- Fixes bug introduced in patch erl_458 that might have damaging effects on the supervisor causing unwanted behavior in the node.
  (Own Id: OTP-4585)
  (Aux Id: seq7713)

- erl_tar: Fixed a problem in extracting where a directory leading up to a symbolic link was not created if it didn't exist.
  (Own Id: OTP-4595)

- ets:select could sometimes return an empty list although the match_spec was syntactically incorrect, due to the fact that no field in the table could match the head of the match_spec. As the match_spec was actually wrong, a badarg exception was expected. ets:select now always throws badarg when the match_spec cannot be compiled.
  (Own Id: OTP-4598)

- The names of temporary files created by the module `file_sorter` are now more unique than they used to be.
  (Own Id: OTP-4600)

- The file and filename modules now accept the same filenames. (Earlier version of the filename module did not accept atoms except at the top-level.) The documentation for file and filename has been updated.
  (Own Id: OTP-4604)

- A bug in `Dets` that could cause a loop has been fixed.
  (Own Id: OTP-4609)

- A file descriptor leak was removed in the error logger.
  (Own Id: OTP-4641)

- The linter now emits errors for unsafe variables in short circuit Boolean expressions (`andalso` and `orelse`).
  (Own Id: OTP-4671)

- ms_transform now handles record index (#a.b) in guards and bodies correctly. It also detects multiply defined records fields correctly (#a{a=3,a=3} gives error).
  (Own Id: OTP-4708)

- A bug in `Dets` that could crash the Dets server has been fixed.
  (Own Id: OTP-4730)

### Improvements and new features

- The previously undocumented modules `erl_tar` and `filelib` are now documented.
  (Own Id: OTP-3135)
  (Aux Id: OTP-1633)

- A number of new functions has been added to the module queue, mostly regarding double-ended operations. See the documentation for details.
  (Own Id: OTP-4113)
  (Aux Id: Seq7134)

- New functions in gen_fsm: send_event_after/2, start_timer/2 and cancel_timer/1 for FSM internal timer handling. See the documentation.
  (Own Id: OTP-4146)
  (Aux Id: Seq 7075)

- The `-include` and `-include_dir` directives substitute environment variable values for first path components beginning with a `$` (dollar) sign.
  (Own Id: OTP-4385)
  (Aux Id: seq7349)

- The format of Dets files has been slightly changed for the purpose of reducing the risk of memory problems due to corrupt files.
  (Own Id: OTP-4553)

- New function `dets:is_compatible_bchunk_format/2` to be used in conjunction with the new info tag `bchunk_format`.
  (Own Id: OTP-4554)

- A variant of rpc:multicall with timeout is added, and gen_server:multi_call has been fixed to discard late answers.
  (Own Id: OTP-4586)

- The Erlang interpreter has been optimized in such a way that tail recursive calls in the interpreted code lead to tail recursive calls in the interpreter.
  (Own Id: OTP-4619)

- erlang:memory/0 and erlang:memory/1 have been added. erlang:memory/[0,1] return the same type of information as c:memory/[0,1] previously did. The erlang:memory/[0,1] functions operate in constant time. c:memory/[0,1] now use erlang:memory/[0,1] and do therefore now also operate in constant time (which they previously did not).
  erlang:memory/[0,1] return more accurate information than c:memory/[0,1] previously did.
  For more information about erlang:memory/[0,1] see the erlang(3) man page.
  (Own Id: OTP-4637)

- The new functions `exprs/4`, `expr/4` and `expr_list/4` in the `erl_eval` module add the possibility to supply a function that handles calls to nonlocal functions.
  (Own Id: OTP-4643)
  (Aux Id: seq7810)

- Introduces a new API function gen_server:enter_loop/[4,5] that may be useful when a more complex initialization procedure is needed than the gen_server behaviour provides
  (Own Id: OTP-4662)
  (Aux Id: seq7713, seq1051)

- To give applications better control of conversion of local time to UTC with respect to daylight saving time, there are two new functions: erlang:localtime_to_universaltime/2 and calendar:local_time_to_uinversal_time_dst/1. See the documentation for details.
  (Own Id: OTP-4667)
  (Aux Id: seq7797)

- There are new functions in `proc_lib` for spawning processes using a fun: `spawn/1,2`, `spawn_link/1,2`, and `spawn_opt/2,3`. `spawn_opt/5` is new as well. The reason for making all `spawn` functions in `erlang(3)` accessible from `proc_lib` is that when SASL is running you get crash reports for processes started using `proc_lib`, something that comes in handy during debugging.
  (Own Id: OTP-4704)
  (Aux Id: OTP-4718, OTP-4719)

- The timer module is optimized. Previously the performance degraded linearly by the number of simultaneously active timers and was very poor if there where 1000 timers or more. Now this linear behaviour is removed and the time to create and cancel a timer is constant and independent of the number of timers.
  (Own Id: OTP-4722)

- Matching on the toplevel in the head of a fun sent to ets/dbg:fun2ms is now possible, creating a more natural way of accessing the match_spec variable '$_'. Thus then code ets:fun2ms(fun(A ={a,_}) -> A end) will work as expected.
  (Own Id: OTP-4743)

- A http state bug in inet_drv (affecting gen_tcp) has been fixed. Patch from Claes Wikström.

  A bug in defining max number of ports has been fixed. Patch from Claes Wikström.

  A bug in erlang:port_call/3 when calling a driver with a NULL driver struct ->call field has been fixed. Patch from Luke Gorrie.

  There is a new function file:script/1,2 that does the same as file:eval/1 but gives a return value. For completness, file:path_script/2,3, file:eval/2 and file:path_eval/3 are also added. Suggestion from Ulf Wiger. See the documentation for details.

  `erlang:trace/3` did no clear trace flags on processes that were exiting. This bug has now been fixed.

  The gen_udp options `add_membership` and `drop_membership` are now allowed. Patch from Vance Shipley.

  `gen_udp:open/1,2` with service name instead of port number now works. Patch from carlos@lfcia.org.

  An unjustified compiler warning when using an explicit space character as pad character to `io:format/2` and similar has been removed.

  If an illegal node name is used to start a node, now `net_kernel` fails noisily instead of just letting the node start in non-distributed mode.

  Now `gen_server:format_status/2` also works with non-registered processes.

  There are two new functions `erlang:list_to_integer/2` and `erlang:integer_to_list/2` that takes a number base argument. See the documentataion for details.

  New format characters for `io:format/2` and similar are ~b, ~B, ~x, ~X, ~+ and ~#. See the documentaion for details.

  New format characters for `io:fread/2` and similar are ~u, ~- and ~#. See the documentation for details.

  The token scanner `erl_scan` has been rewritten to become twice as fast as before. Now, incomplete any-base numbers such as "16#" are regarded as errors instead of as zero. The allowed base number range has been extended to 2..36 instead of previously 2..16.

  There is a new function `lists:split/2`. See the documentation.

  For everyone that has written their own function to calculate the time difference between two `now()` calls there is now `timer:now_diff/2`. See the documentation.
  (Own Id: OTP-4747)

## Stdlib 1.11.0

### Fixed errors and malfunctions

- The nxdomain error code was added to the erl_posix_msg module.
  (Own Id: OTP-2759)
  (Aux Id: seq 1212)

- `lists:sort/2` and `lists:merge/3` were not stable. `lists:ukeysort/3` and `lists:usort/2` could leave duplicates. A bug in `lists:umerge/3` has been fixed.
  (Own Id: OTP-4204)

- Traversing a read only Dets table no longer results in a crash.
  (Own Id: OTP-4208)

- When converting a version 8 Dets file or repairing a version 9 Dets file containing sufficiently large objects, the resulting file was sometimes badly formed. This has been fixed.
  (Own Id: OTP-4220)

- Dets: `delete_object` after `insert` on a table of `set` type could cause crash; it was sometimes impossible to open a fragmented table; `init_table` did not always call `InitFun` exactly once; `delete_all_objects` did not handle fixed tables correctly. (Own Id: OTP-4268)

- Bugs have been fixed in the `erl_lint` module. The compile options due to `erl_lint` are now documented in `compile(3)`.
  (Own Id: OTP-4356)

- A bug in `sofs:drestriction/3` has been fixed.
  (Own Id: OTP-4451)

- A fun with 12 arguments called from the shell would only be passed the first 11 arguments, causing a function_clause or badarity exception.
  (Own Id: OTP-4456)

### Improvements and new features

- A convenient way to create match specifications for ets is provided by the pseudo function ets:fun2ms/1 and the parse_transform ms_transform.

- Documentation of the previously undocumented proc_lib:spawn_opt/4, and the spawn_opt option of gen_server:start, and gen_fsm:start has been added.
  (Own Id: OTP-4189)

- The `file_sorter` module now recognises a format called `binary` which compares binaries using the standard order of terms.
  (Own Id: OTP-4221)

- Dets: The function `init_table` recognizes the new options `min_no_slots` and `format`. The new function `bchunk` can be used in conjunction with `init_table` for copying open tables efficiently.
  (Own Id: OTP-4268)

- The `file_sorter` module now provides an easy way of passing a value from input functions to output functions: if the last input function returns `{end_of_input, Value}`, the first output function is called with the argument `{value, Value}`.
  (Own Id: OTP-4326)

- The function ets:select_count/2 is added to the stdlib application.
  (Own Id: OTP-4407)
  (Aux Id: seq7482)

- New functions `sofs:extension/3` and `sofs:partition/3`.
  (Own Id: OTP-4449)

- The undocumented and deprecated module 'bplus_tree' in stdlib has been removed.
  (*** POTENTIAL INCOMPATIBILITY ***)
  (Own Id: OTP-4468)

- The deprecated module 'unix' has been removed. (Use 'os' instead.)
  (*** POTENTIAL INCOMPATIBILITY ***)
  (Own Id: OTP-4470)

There are also release notes for older versions.