aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
AgeCommit message (Collapse)Author
2011-11-30Merge branch 'siri/stdlib/dialyzer-log_mf_h/OTP-9754'Siri Hansen
* siri/stdlib/dialyzer-log_mf_h/OTP-9754: Fix dialyzer warning about gen_event callback init/1 in log_mf_h
2011-11-30Fix dialyzer warning about gen_event callback init/1 in log_mf_hSiri Hansen
The warning is about log_mf_h having a different spec for gen_event callback init/1 than defined in gen_event.erl. log_mf_h allows return value {error,Reason}, while gen_even only specifies successful return values. This commit add {error,Reason} as a valid return value to the gen_event callback, since this is handled by the code.
2011-11-29Fix dialyzer warnings in supervisorSiri Hansen
Dialyzer complained over a mismatch between the callback spec of Mod:code_change in gen_server and the spec of supervisor:code_change (which is the implementation of a gen_server Mod:code_change). This commit changes the callback spec to allow {error,Reason} as return value. Also, release_handler is updated to handle this return value.
2011-11-29shell: Eliminate use of tuple funsBjörn Gustavsson
2011-11-29erl_eval: Eliminate use of tuple funsBjörn Gustavsson
2011-11-28otp_internal: Deprecate ssl:pid/1Björn Gustavsson
2011-11-28Merge branch 'bjorn/compiler/options/OTP-9752'Björn Gustavsson
* bjorn/compiler/options/OTP-9752: filename documentation: Recommend against using filename:find_src/1,2 Teach filename:find_src/1,2 to handle slim or stripped BEAM files filename: Eliminate failing call to Mod:module_info(source_file) filename.erl:filter_options/1: Remove handling of dead options compiler: Don't include {cwd,_} in module_info(compile) compiler: Don't include source code options in module_info(compile) hipe: Teach hipe to handle slim or stripped BEAM files
2011-11-28Merge branch 'bjorn/major-release-cleanups'Björn Gustavsson
* bjorn/major-release-cleanups: observer tests: Test compatibility with R13, not R12 emulator tests: Test compatibility with R13, not R12 Teach the compiler the 'r14' option erl_lint: The types introduced in R12B-5 are no longer "newly introduced" otp_internal: Stop warning for functions removed in R12 or earlier Conflicts: lib/stdlib/src/otp_internal.erl
2011-11-24Teach filename:find_src/1,2 to handle slim or stripped BEAM filesBjörn Gustavsson
filename:find_src/1,2 will crash when asked to find the source corresponding to a BEAM with no compilation options. A BEAM file can be missing compilation options if it has been stripped using beam_lib:strip/1 or compiled using the undocumented 'slim' option. Why this matters: If ERL_COMPILE_OPTIONS is set to +slim before building Erlang/OTP, there will be a crash in 'igor' during the building of the public_key application. ('igor' merges several source code files, and uses filename:find_src/1,2 to find the source code.) Change filename:find_src/1,2 to return an empty option list if there are no options in the BEAM file. Noticed-by: Per Hedeland
2011-11-24filename: Eliminate failing call to Mod:module_info(source_file)Björn Gustavsson
Mod:module_info(source_file) is no longer supported (and have not been for a long time), so calling it will always fail.
2011-11-24filename.erl:filter_options/1: Remove handling of dead optionsBjörn Gustavsson
The 'trace' and 'fast' options are no longer supported. While at it, correct the comment about option filtering.
2011-11-24Merge branch 'bjorn/remove-regexp-module/OTP-9737'Björn Gustavsson
* bjorn/remove-regexp-module/OTP-9737: stdlib: Remove the deprecated regexp module
2011-11-24erl_lint: The types introduced in R12B-5 are no longer "newly introduced"Björn Gustavsson
When a new built-in type is introduced, type definitions with the same name will still be allowed for "a while".
2011-11-24otp_internal: Stop warning for functions removed in R12 or earlierBjörn Gustavsson
When a deprecated function has been removed, the compiler will issue a warning if it sees a call to it, even for functions that were removed as far back as the R9 release. Since the otp_internal module grows when new deprecated functions are added, let's reduce its size somewhat by removing information about functions that were removed in the R12 release or earlier.
2011-11-24Add plugin support for alternative name lookupUlf Wiger
OTP behaviour instances (gen_server, gen_fsm, gen_event) can currently register themselves either locally or globally, and the behaviour libraries (including gen.erl) support both addressing methods, as well as the normal Pid and {Name, Node}. However, there are alternative registry implementations - e.g. gproc - and one can well imagine other ways of locating a behaviour instance, e.g. on a node connected only via a TCP tunnel, rather than via Distributed Erlang. In all these cases, one needs to write extra code to identify the behaviour instance, even though the instance itself need not be aware of how it is located. This patch introduces a new way of locating a behaviour instance: {via, Module, Name}. Module is expected to export a subset of the functions in global.erl, namely: register_name(Name, Pid) -> yes | no whereis_name(Name) -> pid() | undefined unregister_name(Name) -> ok send(Name, Msg) -> Pid Semantics are expected to be the same as for global.erl This can be used in all places where {global, Name} is accepted. faulty export in gen_fsm_SUITE.erl await process death in dummy_via:reset() fix error in gen_[server|fsm]:enter_loop() fix documentation
2011-11-18Merge branch 'siri/sasl/upgrade-erts/OTP-9438'Siri Hansen
* siri/sasl/upgrade-erts/OTP-9438: Fix bug in erts upgrade on windows Add release vsn info to erts_vsn_changed warning Check for sasl application in systools:make_script and make_relup Add syntax check of relup to check_install_release and install_release Add documentation for upgrade from pre R15 to post R15 sasl Handle upgrade from pre R15 to post R15 sasl Step version of sasl to 2.2 for R15 Document upgrade instructions restart_new_emulator and restart_emulator Wait for two restarts in upgrade_restart test Add restart_new_emulator instruction to kernel, stdlib and sasl appups Distinguish restart_new_emulator from restart_emulator in upgrade instructions Upgrade erts: merge sys.config for tmp release instead of using old Allow regexp for version in .appup Restart emulator before running upgrade script when erts is upgraded Conflicts: lib/sasl/src/release_handler.erl lib/sasl/test/release_handler_SUITE.erl
2011-11-17Add restart_new_emulator instruction to kernel, stdlib and sasl appupsSiri Hansen
The appup files for kernel, stdlib and sasl did not contain any UpFromVsn and DownToVsn. This means that it was not possible to create a relup file with systool:make_relup if any of these applications had changed. This commit adds entries in the appup files for a maximum of two major releases back - all with only one upgrade instruction: restart_new_emulator. The point is to allow relups to be generated, but ensure that no soft upgrade is done for these three applications - i.e. they will always cause a restart of the emulator prior to all other upgrade instructions from other applications. Test cases (appup_test) are added to kernel_SUITE, stdlib_SUITE and sasl_SUITE. These all check that expected versions are matched in the appups, and illegal versions (older than two major releases, or in any other way illegal) do not match. The test is written in a general way where it is assumed that the version of these applications are stepped according the the rule that major releases step the second number, maintenance releases step the third number and patches step the fourth number.
2011-11-14Remove all use of global:safe_whereis_name/1Hans Bolinder
Calls to global:whereis_name/1 have been substituted for calls to global:safe_whereis_name/1 since the latter is not safe at all. The reason for not doing this earlier is that setting a global lock masked out a bug concerning the restart of supervised children. The bug has now been fixed by a modification of global:whereis_name/1. (Thanks to Ulf Wiger for code contribution.)
2011-11-14Fix a minor race in gen_fsmHans Bolinder
Fixed a minor race conditions in gen_fsm:start*: if one of these functions returned {error,Reason} or ignore, the name could still be registered (either locally or in global. This is the same modification as was done for gen_server in OTP-7669.
2011-11-10Merge branch 'siri/stdlib/badarg-extract-child/OTP-9669'Siri Hansen
* siri/stdlib/badarg-extract-child/OTP-9669: Handle undefined pid when reporting error from supervisor
2011-11-10Merge branch 'ss/re-split-doc-bug'Henrik Nord
* ss/re-split-doc-bug: Fix re:split spec not to accept option 'global' OTP-9691
2011-11-08Merge branch 'bjorn/create-less-garbage'Björn Gustavsson
* bjorn/create-less-garbage: Optimize filename:basename/1 to produce less garbage Optimize filename:extension/1 to produce less garbage sys.c for Unix: Undo caching of utsname in os_flavor() Pre-build the tuples returned by os:type/0 and os:version/0
2011-11-07Optimize filename:basename/1 to produce less garbageBjörn Gustavsson
In most cases, we can simply return a tail of the flattened filename.
2011-11-07EEP-23: Allow variables in fun M:F/ABjörn Gustavsson
Currently, the external fun syntax "fun M:F/A" only supports literals. That is, "fun lists:reverse/1" is allowed but not "fun M:F/A". In many real-life situations, some or all of M, F, A are not known until run-time, and one is forced to either use the undocumented erlang:make_fun/3 BIF or to use a "tuple fun" (which is deprecated). EEP-23 suggests that the parser (erl_parse) should immediately transform "fun M:F/A" to "erlang:make_fun(M, F, A)". We have not followed that approach in this implementation, because we want the abstract code to mirror the source code as closely as possible, and we also consider erlang:make_fun/3 to be an implementation detail that we might want to remove in the future. Instead, we will change the abstract format for "fun M:F/A" (in a way that is not backwards compatible), and while we are at it, we will move the translation from "fun M:F/A" to "erlang:make_fun(M, F, A)" from sys_pre_expand down to the v3_core pass. We will also update the debugger and xref to use the new format. We did consider making the abstract format backward compatible if no variables were used in the fun, but decided against it. Keeping it backward compatible would mean that there would be different abstract formats for the no-variable and variable case, and tools would have to handle both formats, probably forever. Reference: http://www.erlang.org/eeps/eep-0023.html
2011-11-02Fix re:split spec not to accept option 'global'Shunichi Shinohara
2011-10-28Handle undefined pid when reporting error from supervisorSiri Hansen
2011-10-27stdlib: Remove the deprecated regexp moduleBjörn Gustavsson
2011-10-20Merge branch 'rc/epp-include-path-fix'Henrik Nord
* rc/epp-include-path-fix: Make epp search directory of current file first when including another file OTP-9645
2011-10-20Merge branch 'hl/fix-ms_transform-scope-warn'Henrik Nord
* hl/fix-ms_transform-scope-warn: ms_transform: Fix incorrect `variable shadowed' warnings OTP-9646
2011-10-20Merge branch 'cf/simple_one_for_one_shutdown'Henrik Nord
* cf/simple_one_for_one_shutdown: Explain how dynamic child processes are stopped Stack errors when dynamic children are stopped Explicitly kill dynamic children in supervisors Conflicts: lib/stdlib/doc/src/supervisor.xml OTP-9647
2011-10-20Merge branch 'cf/supervisor_shutdown_infinity'Henrik Nord
* cf/supervisor_shutdown_infinity: Add a warning to docs about workers' shutdown strategy Allow an infinite timeout to shutdown worker processes OTP-9648
2011-10-18Merge branch 'sverker/random-improved-algo'Sverker Eriksson
* sverker/random-improved-algo: Improve algorithm in module random. Fix a bug in the implementation of the pseudo-random number generator OTP-8713
2011-10-17Make epp search directory of current file first when including another fileRichard Carlsson
The expected behaviour of a C-style preprocessor (such as Erlang's epp) is to allow a header file to include another header file in the same directory even though that directory is not explicitly in the include path, and even if the actual include path might reference another directory containing a file with the same name. For example, if src/foo.erl explicitly includes "../include/foo.hrl", then foo.hrl should be able to include "bar.hrl" in that same directory even though "../include" might not be in the search path, and even if another file named bar.hrl could be found using the search path it should not override the one in the same directory as foo.hrl. In Erlang, the most common situation is that a user of an installed application includes a main public header file using include_lib ("appname/include/foo.hrl") and that file includes a secondary header file "bar.hrl". However, if it does this using include_lib, it causes a bootstrapping problem - in the build environment for the application itself, the application is not necessarily found by name. On the other hand, if foo.hrl uses a plain include, then bar.hrl might be found when the application is built (if explicit paths are set in the makefils) but not later on when a user includes the main header file of the installed application via include_lib. By making -include always look in the directory of the current file before it uses the search path, this problem is remedied, and include directives behave in a more intuitive way. This completes a partial fix in R11 that only worked for include_lib().
2011-10-17Fix a bug in Dets concerning repair of almost full tablesHans Bolinder
A Dets table with sufficiently large buckets could not always be repaired. (Reported by Gordon Guthrie.) The format of Dets files has been modified. When downgrading tables created with the new system will be repaired. Otherwise the modification should not be noticeable.
2011-10-17Correct the docsHans Bolinder
2011-10-10Allow an infinite timeout to shutdown worker processesChristopher Faulet
Now, in child specification, the shutdown value can also be set to infinity for worker children. This restriction was removed because this is not always possible to predict the shutdown time for a worker. This is highly application-dependent.
2011-10-10Fix a minor bug in DetsHans Bolinder
If a Dets table had been properly closed but the space management data could not been read, it was not possible to repair the file.
2011-10-09Optimize filename:extension/1 to produce less garbageBjörn Gustavsson
Simply return a tail of the flattened filename.
2011-10-07Add '-callback' attributes in stdlib's behavioursStavros Aronis
Replace the behaviour_info(callbacks) export in stdlib's behaviours with -callback' attributes for all the callbacks.
2011-10-07Automatically generate 'behaviour_info' function from '-callback' attributesStavros Aronis
'behaviour_info(callbacks)' is a special function that is defined in a module which describes a behaviour and returns a list of its callbacks. This function is now automatically generated using the '-callback' specs. An error is returned by lint if user defines both '-callback' attributes and the behaviour_info/1 function. If no type info is needed for a callback use a generic spec for it.
2011-10-07Add '-callback' attribute to language syntaxStavros Aronis
Behaviours may define specs for their callbacks using the familiar spec syntax, replacing the '-spec' keyword with '-callback'. Simple lint checks are performed to ensure that no callbacks are defined twice and all types referred are declared. These attributes can be then used by tools to provide documentation to the behaviour or find discrepancies in the callback definitions in the callback module.
2011-09-29Merge branch 'dev' into majorBjörn-Egil Dahlberg
* dev: Update copyright years
2011-09-29Update copyright yearsBjörn-Egil Dahlberg
2011-09-28Merge branch 'dev' into majorBjörn Gustavsson
* dev: distribution_SUITE:bulk_send_bigbig/1: Fail with more information distribution_SUITE: Use unique slave node names beam_lib: Handle rare race in the crypto key server functionality busy_port_SUITE: Avoid crash in register/2 [wx] Re-generate code [wx] Remove optional shadowing clauses [wx] Remove warning [wx] Fix trailing whitespace [wx] Test colors in textctrl [wx] Fix cleanup memory references
2011-09-27beam_lib: Handle rare race in the crypto key server functionalityBjörn Gustavsson
In rare circumstances, there can be a race when the crypto key server is started by beam_lib:crypto_key_fun/1 shortly after stopping it using beam_lib:clear_crypto_key_fun/0. The race occurs because the crypto key server first sends back the reply to the calling process, then terminates. (The race is probably more likely to happen on CPUs with hyper threading.)
2011-09-26Merge branch 'dev' into majorLukas
* dev: Add documentation for cth_log_redirect and built-in hooks Correct wrong match from lists:keyfind Update cth_log_redirect to wait for all error_logger events before ending test Force logging to framework log for parallel tests Add ct_log:ct_log funcion Add a hook for redirecting SASL and error_logger messages Add -enable_builtin_hooks <bool> config option Export write_events and add option to return a string
2011-09-26Merge branch 'lukas/common_test/system_logs_to_ct_log/OTP-9543' into devLukas
* lukas/common_test/system_logs_to_ct_log/OTP-9543: Add documentation for cth_log_redirect and built-in hooks Correct wrong match from lists:keyfind Update cth_log_redirect to wait for all error_logger events before ending test Force logging to framework log for parallel tests Add ct_log:ct_log funcion Add a hook for redirecting SASL and error_logger messages Add -enable_builtin_hooks <bool> config option Export write_events and add option to return a string
2011-09-20Export write_events and add option to return a stringLukas Larsson
2011-09-20Merge branch 'dev' into majorHenrik Nord
Conflicts: erts/aclocal.m4 erts/include/internal/ethread_header_config.h.in
2011-09-16Stack errors when dynamic children are stoppedChristopher Faulet
Because a simple_one_for_one supervisor can have many workers, we stack errors during its shutdown to report only one message for each encountered error type. Instead of reporting the child's pid, we use the number of concerned children.