aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2013-01-23Merge branch 'siri/common_test/minor_test_fixes/OTP-10483'Siri Hansen
* siri/common_test/minor_test_fixes/OTP-10483: [common_test] Extend timetrap time in ct_hooks_SUITE [common_test] Avoid hanging ct@host node if crypto does not exist [common_test] Changed call to publick_key to use documented interface [common_test] Extend timeout values for slave nodes in ct_master_SUITE [common_test] Extend valid interval for approximate timer values in tests
2013-01-23erl_interface: Fix bug when transcoding atoms from and to UTF8Lukas Larsson
2013-01-23erl_interface: Changed erlang_char_encoding interfaceSverker Eriksson
to allow bitwise-or'd combinations.
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-23Simplify the functions for decoding lengthsBjörn Gustavsson
Now that the decoding of all types are generated inline, we can take out most of the code for decoding lengths.
2013-01-23per,uper: Optimize decoding of the remaining data typesBjörn Gustavsson
2013-01-23per,uper: Optimize decoding of the remaining string typesBjörn Gustavsson
2013-01-23Share all code for dec_gen_prim/3 between per/uper back-endsBjörn Gustavsson
2013-01-23per,uper: Optimize decoding of the string data typesBjörn Gustavsson
2013-01-23testPrimStrings: Test some constraintsBjörn Gustavsson
2013-01-23By default, encode BIT STRING to bitstringsBjörn Gustavsson
Add the option 'legacy_bit_string' to decode to the old list format.
2013-01-23Merge branch 'rickard/r16/port-optimizations/OTP-10336'Rickard Green
* rickard/r16/port-optimizations/OTP-10336: Bump reductions also for immediate driver calls Add 'port_count' and 'port_limit' to system_info/1 spec Fix documentation Replace use of deprecated functions in test cases Replace use of driver_send_term() with erl_drv_send_term() Conflicts: erts/preloaded/ebin/erlang.beam
2013-01-23Merge branch 'fredrik/fix-dialyzer-warn-r16'Fredrik Gustafsson
* fredrik/fix-dialyzer-warn-r16: Removed deprecated functions handle_pref_algs with correct return values
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-23Update one more unused funs result as per ffe582bStavros Aronis
2013-01-23Remove pubsub and comm_layer tests from testsuiteStavros Aronis
These tests recently broke because of the deprecation of the package system. Furthermore, they included copyrighted code. Finally they were not minimized not targeted to any specific feature and had no warnings being reported.
2013-01-23Properly support functions with arbitrary arity in type specs.Stavros Aronis
Dialyzer now understands the "fun(...)" syntax in type specs.
2013-01-23Revert "Merge branch 'nox/rm-reverse-eta-conversion/OTP-10682'"Fredrik Gustafsson
This reverts commit 750ecdea08fa5fa7e32b7f3019eed96c1699427e, reversing changes made to 2cfa0466c3b3c7bd5e3621aff0f3e2ca30addb68.
2013-01-23Turn warnings to errors on selected applicationsBjörn Gustavsson
2013-01-23runtime_tools_sup: Eliminate warningBjörn Gustavsson
The warning was introduced in 3b73cabcba3ac6dcc91c7ae2b00f21d254dfdd4b.
2013-01-23inet_parse: Eliminate a compiler warningBjörn Gustavsson
The warning was introduced in e367eb44969b00cac910c8eb14e7b3ce3ee0cc91.
2013-01-23Merge branch 'fredrik/fix-merge-dialyzer/R16'Fredrik Gustafsson
* fredrik/fix-merge-dialyzer/R16: Fixed merge issue
2013-01-23Fixed merge issueFredrik Gustafsson
2013-01-23public_key: Include some PKCS-9 support needed by PKCS-10Ingela Anderton Andin
Due to some limitations in the ASN-1 compiler we inline some PKCS-9 in other specs for now. Also corrected documentation.
2013-01-23Merge branch 'bjorn/compiler/binary-syntax-bug/OTP-10724'Björn Gustavsson
* bjorn/compiler/binary-syntax-bug/OTP-10724: compiler: Eliminate internal consistency failure in binary matching
2013-01-23Add a warning to discourage abuse of $handle_undefined_function/2Björn Gustavsson
2013-01-23Merge branch 'sa/dialyzer-list-spec/OTP-10740'Fredrik Gustafsson
* sa/dialyzer-list-spec/OTP-10740: Report spec discrepancy on mismatching lists Properly support functions with arbitrary arity in type specs. Conflicts: lib/dialyzer/test/small_SUITE_data/results/empty_list_infimum
2013-01-23Report spec discrepancy on mismatching listsStavros Aronis
2013-01-23ssl: Too short timeout in test caseIngela Anderton Andin
2013-01-22erl_interface: even more utf8 atom stuffSverker Eriksson
2013-01-22Teach encode functions to accept a bitstring term for a BIT STRINGBjörn Gustavsson
We do it in the simplest possible way by converting the bitstring to a compact bitstring tuple. The encoding of BIT STRINGs should be cleaned up and optimized.
2013-01-22Fix EXTERNAL 1990/1994 conversion information lossBjörn Gustavsson
There are two different definitions of the EXTERNAL data type in ASN.1: the original from 1990 and an updated from 1994. Both defintions are encoded in the same way (in BER). There are still systems in use that use the old definition of EXTERNAL, so the asn1 application must still support both. It has been decided that the asn1 application should handle both the forms without any compiler options. Internally the asn1 application uses the 1990 definition. The encode functions will accept both definitions, but translate the 1994 format to the 1990 format if needed. When decoding, it will decode to the 1990 definition format first and then translate to the 1994 defintion format. One problem with this approach is that the conversion to the 1994 format may not be loss-less (where the 1990 defintion had a CHOICE between an OPEN TYPE, OCTET STRING, or BIT STRING, the 1994 definition only supports an OCTET STRING), and therefore it might not be possible to correctly re-encode the data in the 1990 format. It seems that the only reliable way to handle that problem is to not do the conversion to the 1994 format if the conversion is not loss-less. (There is an attempt when translating to the 1990 format to recover the CHOICE alternative based on the Erlang type of the data value, but that is neither reliable nor future-proof.) That is, when decoding an EXTERNAL value, the resulting tuple could either conform to the 1990 or 1994 definition, and applications must be prepared to handle that. The mail conversation where this issue was first reported can be found here: http://erlang.org/pipermail/erlang-questions/2011-April/057697.html Reported-by: Harald Welte <[email protected]>
2013-01-22uper: Look up some SizeConstraints at compile-timeBjörn Gustavsson
2013-01-22Enumeration decoding: Don't emit a default clause if it cannot matchBjörn Gustavsson
Dialyzer will warn for default clauses that cannot possible match.
2013-01-22Slightly optimize per encoding of large INTEGERs with constraintsBjörn Gustavsson
2013-01-22BER run-time: Refactor decoding of string data typesBjörn Gustavsson
In the BER run-time code (asn1rtt_ber), there is a general function for decoding a string: decode_restricted_string(Tlv, Range, StringType, TagsIn) But the StringType argument is not important. It is only used internally in asn1rtt_ber to distinguish universal strings and BMP strings from other strings. By slightly refactoring the string decoding code, we can eliminate the StringType argument and a subsequent run-time test on the string type. That will slightly reduce code size, slightly increase speed, and eliminate Dialyzer warnings.
2013-01-22Refactor decoding of BIT STRINGsBjörn Gustavsson
Refactor decoding of BIT STRINGs so that the run-time code does not spend testing conditions that are known already at compile-time (which wastes time and produces unnecessary Dialyzer warnings). There are three ways to decode BIT STRINGs: 1) To a list of bit names (and {bit,Position} for unnamed positions) if the BIT STRING type has any bit names. 2a) To a list of ones and zeros if there are no named bits, and the compact_bit_string option was NOT given. 2b) To a {Unused,Bin} tuple if there are no named bits compact_bit_string option WAS given. Structure the decoding functions in the same way.
2013-01-22Optimize encoding of ENUMERATED in per and uperBjörn Gustavsson
Always pre-encode the values for the enumeration. Clean up the code and let the per and uper back-ends share the code.
2013-01-22Remove the unused run-time modulesBjörn Gustavsson
2013-01-22eldap: Remove calls to undocumented asn1rt* functionsBjörn Gustavsson
We are about to remove the old asn1rt* modules, so we must remove the calls that eldap make to them. Since the calls are just a sanity check, we can just remove the calls. Just doing the decode will do roughly the same tests and generate similar exceptions.
2013-01-22BER: Correct bug in 'undec_rest'Björn Gustavsson
enif_make_new_binary() cannot return NULL, so while at it, remove the check for return value of enif_make_new_binary() being NULL.
2013-01-22Correct error handling for the NIF functionsBjörn Gustavsson
Also make sure that the error handling is contained within the asn1rt_nif module and does not leak out to generated code.
2013-01-22Generate modules with selected run-time functions for compiler usageBjörn Gustavsson
2013-01-22Remove the 'inline' and '{inline,OutputFile}' optionsBjörn Gustavsson
2013-01-22Add and use asn1rtt_extBjörn Gustavsson
2013-01-22Add and use asn1rtt_checkBjörn Gustavsson
2013-01-22Add run-time library templates and use themBjörn Gustavsson
The template modules (asn1rtt_*.erl) are based on the existing run-time modules, but with some simplifications and improvements, for example: The run-time functions for BER encoding took a Constraint argument which was not used. It has been eliminated, along with the unused StringType argument for the encode_restricted_string function. The Range argument for decode_enumerated() has been dropped since it was not used.
2013-01-22Add a mechanism for embedding run-time functions into the generated codeBjörn Gustavsson
2013-01-22Fix a bug where necessary alignment would be skippedBjörn Gustavsson