aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
AgeCommit message (Collapse)Author
2013-02-18Update file_name_SUITEBjörn Gustavsson
Because {prim_file,file}:list_dir/1 no longer returns untranslatable filenames, we must use list_dir_all/1 instead. We also need to use read_link_all/1 instead of read_link/1.
2013-02-18Fix broken file:read_link_all/1Björn Gustavsson
It produced the same result as file:read_link/1.
2013-02-18Fix broken prim_file:list_dir_all/1Björn Gustavsson
6d516de001dde82c02fe050db8e3aab47914fa90 added prim_file:list_dir_all/1. Unfortunately, only the first element in the list would be handled as intended.
2013-02-15Merge branch 'sc/gen_tcp_send_error_closed/OTP-10839'Fredrik Gustafsson
* sc/gen_tcp_send_error_closed/OTP-10839: Fix type of error Reason on gen_tcp:send/2
2013-02-14Merge branch 'bjorn/stdlib/filelib-wildcard/OTP-10812'Björn Gustavsson
* bjorn/stdlib/filelib-wildcard/OTP-10812: Remove special case handling "-" at the beginning of a charset Optimize character sets using gb_sets Clean up and simplify the inner matching loop Only sort the result list once, just before returning Replace filename:join/2 with '++' Rethink the filelib:wildcard() functions Don't redefine error/1 Don't allow binaries as the Cwd argument for filelib:wildcard() Don't handle binaries from file:list_dir/1 Strengthen test suite
2013-02-14Merge branch 'bjorn/stdlib/types'Björn Gustavsson
* bjorn/stdlib/types: Make the file:filename() type more restrictive c: Remove handling of binaries in return from file:list_dir/1
2013-02-13Rethink the filelib:wildcard() functionsBjörn Gustavsson
Commit 70b5e24c9498225fadc08d19503269c8aad851bf broke filelib:wildcard(Pattern, "."). Over the years, the logic for filelib:wilcard() has become a mess of special cases. Probably because of premature optimization, filelib:wildcard(Pattern) and filelib:wildcard(Pattern, Cwd) are handled differently. They can be consolidated if we use a "." as the default Cwd argument. We can also simplify things by compiling the Cwd argument into the wildcard. We did not that in the initial implementation because it used to be possible to pre-compile a wildcard and pass it to filelib:wildcard/{1,2}. Since that is no longer possible, there is no point in keeping the compiled wildcard "portable" (not dependent on the Cwd argument).
2013-02-13[kernel] FIx a bug that could cause crash with wrong reasonHans Bolinder
2013-02-13Make the file:filename() type more restrictiveBjörn Gustavsson
The recommended type for filenames is a list of characters (which may be Unicode characters greater than 255). Change the file:filename() to reflect that. For the filename module we still need a type that can be either a string or a binary, so we need to introduce the type file:filename_all().
2013-02-12Merge branch 'pan/unicode_filename_warnings'Björn Gustavsson
* pan/unicode_filename_warnings: Add file:list_dir_all/1 and file:read_link_all/1 prim_file: Add list_dir_all() and read_link_all() Teach prim_file:set_cwd() to avoid entering non-translatable directories Make prim_file skip invalid filenames in unicode mode prim_file: Refactor functions that return filenames prim_file: Refactor handling of responses prim_file: Always open non-file ports in binary mode Test that list_dir("non-existing-dir") fails with the correct error
2013-02-11Fix type of error Reason on gen_tcp:send/2Sean Cribbs
When the TCP socket is in passive mode, it is possible that a close message has not been delivered to the controlling process before calling send/2. This results in the returning {error, closed} to the caller, in the same way that recv/2,3 does. This commit adjusts the type of the error "Reason" to include the atom 'closed'.
2013-02-11Add file:list_dir_all/1 and file:read_link_all/1Björn Gustavsson
2013-02-11Make Unicode correctionsHans Bolinder
2013-02-11prim_file: Add list_dir_all() and read_link_all()Björn Gustavsson
2013-02-11Merge branch 'vd/code_get_mode/OTP-10823'Fredrik Gustafsson
* vd/code_get_mode/OTP-10823: Added name prefix to code.xml Add a new function code:get_mode() can be used to detect how the code servers behaves
2013-02-08Test that list_dir("non-existing-dir") fails with the correct errorBjörn Gustavsson
2013-02-06Merge branch 'mh/duplicate_name_error_message/OTP-10797'Fredrik Gustafsson
* mh/duplicate_name_error_message/OTP-10797: Slightly nicer error message when node start fails due to duplicate name
2013-02-04Merge branch 'bjorn/remove-packages/OTP-10348'Björn Gustavsson
* bjorn/remove-packages/OTP-10348: kernel docs: Remove references to specs_packages.xml
2013-02-04Update version numbersBjörn-Egil Dahlberg
2013-02-04Added name prefix to code.xmlFredrik Gustafsson
2013-02-01Add a new function code:get_mode() can be used to detect how the code ↵Vlad Dumitrescu
servers behaves Rationale: Some applications (like erlide) have code to be loaded dynamically on a node. It may be slow to load everything upfront every time, so if the node is in interactive mode, we would like to just append to the load path. Currently, there is no direct way to detect if the node is running in embedded mode or not so that we can do the right thing.
2013-01-31kernel docs: Remove references to specs_packages.xmlBjörn Gustavsson
2013-01-29Prepare releaseOTP_R16A_RELEASE_CANDIDATEErlang/OTP
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-25Slightly nicer error message when node start fails due to duplicate nameMagnus Henoch
When starting up an Erlang node using a node name that is already in use, the new node used to crash with output starting with this message: {error_logger,{{2013,1,25},{16,0,42}},"Protocol: ~p: register error: ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1,[..... With this change, the first line in the output changes to: {error_logger,{{2013,1,25},{16,40,41}},"Protocol: ~tp: the name foo@localhost seems to be in use by another Erlang node",["inet_tcp"]}
2013-01-25Make adjustments for UnicodeHans Bolinder
2013-01-25[kernel] Correct bugs in the old shell (user.erl)Hans Bolinder
The inline attribute has been simplified due to problems with compiling to native code. The exact cause it beyond the scope of this commit.
2013-01-25[stdlib] Remove documentation of Unicode functions in io_libHans Bolinder
The documentation of some Unicode functions in io_lib was committed by mistake.
2013-01-24Merge branch 'bjorn/kernel/undefined-function-handler/OTP-10617'Björn Gustavsson
* bjorn/kernel/undefined-function-handler/OTP-10617: Add a warning to discourage abuse of $handle_undefined_function/2
2013-01-24Merge branch 'bjorn/warnings-zero-tolerance'Björn Gustavsson
* bjorn/warnings-zero-tolerance: Turn warnings to errors on selected applications runtime_tools_sup: Eliminate warning inet_parse: Eliminate a compiler warning
2013-01-23Merge branch 'sverk/r16/utf8-atoms'Sverker Eriksson
* sverk/r16/utf8-atoms: erl_interface: Fix bug when transcoding atoms from and to UTF8 erl_interface: Changed erlang_char_encoding interface erts: Testcase doing unicode atom printout with ~w erl_interface: even more utf8 atom stuff erts: Fix bug in analyze_utf8 causing faulty latin1 detection Add UTF-8 node name support for epmd workaround... Fix merge conflict with hasse UTF-8 atom documentation test case erl_interface: utf8 atoms continued Add utf8 atom distribution test cases atom fixes for NIFs and atom_to_binary UTF-8 support for distribution Implement UTF-8 atom support for jinterface erl_interface: Enable decode of unicode atoms stdlib: Fix printing of unicode atoms erts: Change internal representation of atoms to utf8 erts: Refactor rename DFLAG(S)_INTERNAL_TAGS for conformity Conflicts: erts/emulator/beam/io.c OTP-10753
2013-01-23Add testcase for oct countersPatrik Nyblom
2013-01-23Fix efile_drv crash when using async thread poolFilipe David Borba Manana
When using the async thread pool and compressed files, when an efile driver port instance is shutdown, the efile_drv stop callback closes the file descriptor (a gzFile instance actually) - this is dangerous if at the same time there's an async thread performing an operation against the file, for example calling invoke_read(), which can result in a segmentation fault, or calling invoke_close() which double closes the gzFile and this in turn causes 2 consecutive calls to driver_free() against same gzFile instance (resulting in later unexpected crashes in erl_bestfit_alloc.c for example). The following test program makes the emulator crash when using the async thread pool: -module(t2). -export([t/1]). t(N) -> file:delete("foo.bar"), % Use of 'compressed' option, for creating/writing the file, % is irrelevant. It only matters when opening it later for % reads - a non-compressed file open with the 'compressed' % option goes through an internal gzFile handle (instead of % a plain integer fd), just like a compressed file. %{ok, Fd} = file:open("foo.bar", [raw, write, binary]), {ok, Fd} = file:open("foo.bar", [raw, write, binary, compressed]), ok = file:write(Fd, <<"qwerty">>), ok = file:close(Fd), Pid = spawn_link(fun() -> process_flag(trap_exit, true), loop(N) end), Ref = erlang:monitor(process, Pid), receive {'DOWN', Ref, _, _, _} -> ok end. loop(0) -> ok; loop(N) -> Server = self(), Pid = spawn(fun() -> {ok, Fd} = file:open("foo.bar", [read, raw, binary, compressed]), Server ! continue, % Comment the file:read/2 call to make the file:close/1 call much % more likely to crash or end up causing efile_drv to close twice % the fd (gzFile), which will make the emulator crash later in the % best fit allocator (erl_bestfit_alloc.c). _ = file:read(Fd, 5), file:close(Fd) end), receive continue -> ok end, exit(Pid, shutdown), loop(N - 1). Running this test when using the async thread pool: shell> erl +A 4 Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:4] [hipe] [kernel-poll:false] Eshell V5.9.3.1 (abort with ^G) 1> c(t2). {ok,t2} 2> t2:t(500000). Segmentation fault (core dumped) When not using the async thread pool, there are no issues: shell> erl Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.3.1 (abort with ^G) 1> c(t2). {ok,t2} 2> t2:t(500000). ok 3> An example stack trace when the crash happens because there's an ongoing read operation is: Thread 1 (Thread 0x7f021cf2c700 (LWP 10687)): #0 updatewindow (strm=0x2691bf8, out=5) at zlib/inflate.c:338 #1 0x00000000005a2ba0 in inflate (strm=0x2691bf8, flush=0) at zlib/inflate.c:1141 #2 0x000000000055c46a in erts_gzread (file=0x2691bf8, buf=0x7f0215b29e80, len=5) at drivers/common/gzio.c:523 #3 0x00000000005849ef in invoke_read (data=0x26b2228) at drivers/common/efile_drv.c:1114 #4 0x000000000050adcb in async_main (arg=0x7f021bf5cf40) at beam/erl_async.c:488 #5 0x00000000005c21a0 in thr_wrapper (vtwd=0x7fff69c6ff10) at pthread/ethread.c:106 #6 0x00007f021c573e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #7 0x00007f021c097cbd in clone () from /lib/x86_64-linux-gnu/libc.so.6 #8 0x0000000000000000 in ?? () And when there's an ongoing close operation when the driver is stopped: Thread 1 (Thread 0x7fe5f5654700 (LWP 747)): #0 0x0000000000459b64 in bf_unlink_free_block (block=0x10b2a70, allctr=<optimized out>, flags=<optimized out>) at beam/erl_bestfit_alloc.c:792 #1 bf_unlink_free_block (flags=0, block=0x10b2a70, allctr=0x873380) at beam/erl_bestfit_alloc.c:822 #2 bf_get_free_block (allctr=0x873380, size=<optimized out>, cand_blk=<optimized out>, cand_size=<optimized out>, flags=0) at beam/erl_bestfit_alloc.c:869 #3 0x000000000044f0dd in mbc_alloc_block (alcu_flgsp=<synthetic pointer>, blk_szp=<synthetic pointer>, size=200, allctr=0x873380) at beam/erl_alloc_util.c:1198 #4 mbc_alloc (allctr=0x873380, size=200) at beam/erl_alloc_util.c:1345 #5 0x000000000045449b in do_erts_alcu_alloc (size=200, extra=0x873380, type=165) at beam/erl_alloc_util.c:3442 #6 erts_alcu_alloc_thr_pref (type=165, extra=<optimized out>, size=192) at beam/erl_alloc_util.c:3520 #7 0x000000000055c0bf in gz_open (mode=0x5d98b2 "rb", path=0x1103418 "foo.bar") at drivers/common/gzio.c:164 #8 erts_gzopen (path=0x1103418 "foo.bar", mode=0x5d98b2 "rb") at drivers/common/gzio.c:307 #9 0x0000000000584e47 in invoke_open (data=0x1103330) at drivers/common/efile_drv.c:1857 #10 0x000000000050adcb in async_main (arg=0x7fe5f698af80) at beam/erl_async.c:488
2013-01-23Merge branch 'fh/shell_history_search/OTP-10739'Fredrik Gustafsson
* fh/shell_history_search/OTP-10739: Add search to Erlang shell's history
2013-01-23Turn warnings to errors on selected applicationsBjörn Gustavsson
2013-01-23inet_parse: Eliminate a compiler warningBjörn Gustavsson
The warning was introduced in e367eb44969b00cac910c8eb14e7b3ce3ee0cc91.
2013-01-23Add a warning to discourage abuse of $handle_undefined_function/2Björn Gustavsson
2013-01-21[hipe, kernel, stdlib] Correct a few typesHans Bolinder
The type ascii_string() in the base64 module has been corrected. The type file:file_info() has been cleaned up. The type file:fd() has been made opaque in the documentation. The type nodes() has been removed from erl_bif_types.erl.
2013-01-21Merge branch 'lukas/kernel/iter_max_socks_to_node/OTP-10734'Lukas Larsson
* lukas/kernel/iter_max_socks_to_node/OTP-10734: Isolate iter_max_socks to own node
2013-01-21Isolate iter_max_socks to own nodeLukas Larsson
This prevents this testcase from ruining the entire testrun if it should fail critically.
2013-01-19Add search to Erlang shell's historyFred Hebert
Search mode can be entered by pressing ctrl-r. Enter terms and press ctrl-r again to search backwards, or ctrl-s to then search forward (if you terminal doesn't eat up that one). Press enter to execute the line, or use tab, arrow keys, or other control sequences (^D, ^K, etc.) to exit search mode while remaining on the last found line. Exiting is also possible by pressing the escape key twice. The search mode is a simpler version of the one available in bash or zsh shells. This adds a few modes to the shell (search, on top of none and meta) in group.erl for history search, and a few more in edlin.erl to change the meaning of control sequences while searching.
2013-01-19UTF-8 atom documentationRickard Green
2013-01-18Merge branch 'nox/enable-silent-rules/OTP-10726'Björn-Egil Dahlberg
* nox/enable-silent-rules/OTP-10726: Implement ./otp_build configure --enable-silent-rules
2013-01-18Merge branch 'bjorn/kernel/undefined-function-handler/OTP-10617'Björn Gustavsson
* bjorn/kernel/undefined-function-handler/OTP-10617: Teach error_handler to call '$handle_undefined_function'
2013-01-17global_SUITE: Eliminate redundant registration of 'test_server' processBjörn Gustavsson
global_SUITE registers the name 'test_server' in the global registry for what seems to be only historical reasons. Exactly how it happened is lost in the mists of time, but I think the following is a reasonable reconstruction: * At one point in time, the test_server application started to do a global registration of a 'test_server' process to support embedded systems when the test_server application was run on both a host and a target system. * global_SUITE had to be modified to take the pre-existing 'test_server' registration into account. * When Erlang/OTP switched to using common_test, global_SUITE was modified to register the 'test_server' name itself in commit 8bd07f450816eaaae52d28740d89ead1f930cd02 (since the test_server application does not register the 'test_server' name when run under control of common_test). To slightly reduce the size of global_SUITE, remove the redundant registration and stop expecting 'test_server' to be registered.
2013-01-17Merge branch 'bjorn/remove-packages/OTP-10348'Björn Gustavsson
* bjorn/remove-packages/OTP-10348: compile: Remove vestiges of package support Remove documentation about packages
2013-01-17Merge branch 'sal/get_env/OTP-10694'Fredrik Gustafsson
* sal/get_env/OTP-10694: Moved documentation in a separate entry Removed obsolete ?line macro Add application:get_key/3
2013-01-16UTF-8 support for distributionRickard Green
2013-01-16Remove documentation about packagesBjörn Gustavsson
2013-01-15Implement ./otp_build configure --enable-silent-rulesAnthony Ramine
With silent rules, the output of make is less verbose and compilation warnings are easier to spot. Silent rules are disabled by default and can be disabled or enabled at will by make V=0 and make V=1.