aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
AgeCommit message (Collapse)Author
2017-02-27Merge branch 'egil/pretty-print-maps-smaller/OTP-14239'Björn-Egil Dahlberg
* egil/pretty-print-maps-smaller/OTP-14239: stdlib: Use erts_internal:maps_to_list/2 in io_lib_pretty Update preloaded erts_internal.beam erts: Test erts_internal:maps_to_list/2 erts: Introduce erts_internal:maps_to_list/2
2017-02-24Merge branch 'maint'Björn Gustavsson
* maint: filename: Add safe_relative_path/1 Conflicts: lib/stdlib/src/filename.erl
2017-02-24Merge pull request #1350 from bjorng/bjorn/stdlib/safe-relative-path/OTP-14215Björn Gustavsson
filename: Add safe_relative_path/1 OTP-14215
2017-02-24Merge branch 'bjorn/stdlib/misc-fixes'Björn Gustavsson
* bjorn/stdlib/misc-fixes: c: Reintroduce support for non-list options in c/2 c: Remove unused import of lists:concat/1
2017-02-23stdlib: Use erts_internal:maps_to_list/2 in io_lib_prettyBjörn-Egil Dahlberg
2017-02-22stdlib: Simplify error handling of the sofs moduleHans Bolinder
Atoms ('badarg', 'type_mismatch', &c) are used as errors instead of tuples containing the parameters. This makes it possible for the garbage collector to reclaim memory earlier. Since the exact format of error tuples is undocumented no release note is deemed necessary.
2017-02-22Merge branch 'maint'Hans Bolinder
* maint: [xmerl] Remove faulty throws [xmerl] Fix XML "well-formedness" bug i SAX parser [xmerl] Correct bug handling multiple documents on a stream stdlib: Improve pretty-printing of terms with maps Conflicts: lib/stdlib/test/io_SUITE.erl
2017-02-22c: Reintroduce support for non-list options in c/2Björn Gustavsson
Before 0eb45e21d40 it was possible to write (for example): c(m, dcore) instead of the more verbose: c(m, [dcore]) Reintroduce this convenient shortcut.
2017-02-22c: Remove unused import of lists:concat/1Björn Gustavsson
2017-02-21stdlib: Improve pretty-printing of terms with mapsHans Bolinder
As of committing this branch maps:fold/3 calls maps:to_list/1, which means that the time and memory needed for printing maps is not always proportional to the size of the generated deep list of characters.
2017-02-21filename: Add safe_relative_path/1Björn Gustavsson
Add safe_relative_path/1 to guard against directory traversal attacks. It either returns a shorter path without any ".." or "." components, or 'unsafe' if an ".." component would climb up above the root of the relative path. Here are a few examples: safe_relative_path("a/b/..") => "a" safe_relative_path("a/..") => "" safe_relative_path("a/../..") => unsafe safe_relative_path("/absolute/path") => unsafe The returned path can be used directly or combined with an absolute path using filename:join/2.
2017-02-16Merge pull request #1323 from bitwalker/erl_tar2Björn Gustavsson
Update erl_tar to support PAX format (redux) OTP-14226
2017-02-16Update erl_tar to support PAX format, etc.Paul Schoenfelder
This commit introduces the following key changes: - Support for reading tar archives in formats currently in common use, such as v7, STAR, USTAR, PAX, and GNU tar's extensions to the STAR/USTAR format. - Support for writing PAX archives, only when necessary, using USTAR when possible for greater portability. These changes result in lifting of some prior restrictions: - Support for reading archives produced by modern tar implementations when other restrictions described below are present. - Support for filenames which exceed 100 bytes in length, or paths which exceed 255 bytes (see USTAR format specification for more details on this restriction). - Support for filenames of arbitrary length - Support for unicode metadata (the previous behaviour of erl_tar was actually violating the spec, by writing unicode-encoded data to fields which are defined to be 7-bit ASCII, even though this technically worked when using erl_tar at source and destination, it may not have worked with other tar utilities, and this implementation now conforms to the spec). - Support for uid/gid values which cannot be converted to octal integers.
2017-02-15Merge pull request #1321 from bjorng/bjorn/stdlib/tilde-s-for-atomsBjörn Gustavsson
Make "~s" fail for Unicode atoms
2017-02-15Merge branch 'fix-source-typos'Björn Gustavsson
* fix-source-typos: (25 commits) Fixed typos in system/doc Fixed typos in lib/xmerl Fixed typos in lib/wx Fixed typos in lib/stdlib Fixed typos in lib/snmp Fixed typos in lib/ssl Fixed typos in lib/ssh Fixed typos in PKCS-8.asn1 file Fixed typos in lib/parsetools Fixed typos in lib/orber Fixed typos in lib/mnesia Fixed typos in lib/megaco Fixed typos in lib/kernel Fixed typos in lib/jinterface Fixed typos in lib/inets Fixed typos in lib/hipe Fixed typos in lib/eunit Fixed typos in lib/erl_interface Fixed typos in lib/eldap Fixed typos in lib/edoc ...
2017-02-15Merge pull request #1340 from josevalim/jv-erl-expand-records-to-mapsBjörn Gustavsson
Use maps instead of dict in erl_expand_records
2017-02-14Fixed typos in lib/stdlibAndrew Dryga
2017-02-13Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: ets_tough_SUITE: Add the gen_server behavior ets_tough_SUITE: Remove functions that are never called ets_SUITE: Eliminate internal exports used for spawn/apply lists_SUITE: Run the droplast/1 test case random_{iolist,unicode_list}: Remove unused functions stdlib test: Eliminate export_all from re_SUITE and friends asn1_SUITE: Make sure that there are no unused functions Simplify running of asn1 app tests asn1_SUITE: Remove unused functions
2017-02-12Use maps instead of dict in erl_expand_recordsJosé Valim
2017-02-10ets_tough_SUITE: Add the gen_server behaviorBjörn Gustavsson
Add a declaration to make it clear for tools that this module uses the gen_server behavior. While at it, also remove the totally unnecessary 'export_all' option.
2017-02-10ets_tough_SUITE: Remove functions that are never calledBjörn Gustavsson
2017-02-10ets_SUITE: Eliminate internal exports used for spawn/applyBjörn Gustavsson
In the future we will run xref to make sure that all functions that are exported are also used. Having internal exports only used for spawning or applying will mess with that.
2017-02-10lists_SUITE: Run the droplast/1 test caseBjörn Gustavsson
The testcase was never actually run.
2017-02-10random_{iolist,unicode_list}: Remove unused functionsBjörn Gustavsson
2017-02-10stdlib test: Eliminate export_all from re_SUITE and friendsBjörn Gustavsson
There is no actual need to use export_all, since very few functions are actually called from the outside. While we are it, remove the unused functions in run_pcre_tests.erl.
2017-02-09Merge branch 'maint'Hans Bolinder
* maint: stdlib: Improve Erlang shell's tab-completion of long names
2017-02-09Merge pull request #1312 from richcarl/shell-smart-compileBjörn Gustavsson
Extend shell c(...) to find and recompile modules OTP-14190
2017-02-08stdlib: Improve Erlang shell's tab-completion of long namesHans Bolinder
2017-02-08Deprecate filename:find_src/1/2Richard Carlsson
2017-02-06Use magic refs for binary compile patternsRickard Green
2017-02-06Use magic refs for compiled match specsRickard Green
2017-02-06Add shell shortcut for recompiling existing modulesRichard Carlsson
This extends the shell function c/1 and c/2 so that if the argument is a module name instead of a file name, it automatically locates the .beam file and the corresponding source file, and then recompiles the module using the same compiler options (plus any options passed to c/2). If compilation fails, the old beam file is preserved. Also adds c(Mod, Opts, Filter), where the Filter argument allows you to remove old compiler options before the new options are added.
2017-02-04Add filelib:find_file/2/3 and filelib:find_source/1/2/3Richard Carlsson
This moves, extends and exports functionality that previously existed only internally in filename:find_src/1/2, adding the ability to automatically substitute file suffixes and use different rules for different suffixes.
2017-02-04Refactor filename:find_src/1Richard Carlsson
2017-02-04Fix broken test for filename:find_src/2Richard Carlsson
2017-02-02Make "~s" fail for Unicode atomsBjörn Gustavsson
26b59dfe67e introduced support for arbitrary Unicode characters in atoms. After that commit, it is possible to print any atom with a "~s" format string: 1> io:format("~s\n", ['спутник']). спутник Note that the same text as a string will fail: 2> io:format("~s\n", ["спутник"]). ** exception error: bad argument in function io:format/3 called as io:format(<0.53.0>,"~s\n", [[1089,1087,1091,1090,1085,1080,1082]]) Being more permissive for atoms is probably beneficial for io:format/2. However, for io_lib:format/2, the new behavior breaks this guarantee in the documentation for io_lib:format/2: If and only if the Unicode translation modifier is used in the format string (that is, ~ts or ~tc), the resulting list can contain characters beyond the ISO Latin-1 character range (that is, numbers > 255). The problem is that you can no longer be sure whether io_lib:format/2 will return an iolist that can be successfully passed to a port or iolist_to_binary/1. We see three solutions: 1. Keep the new behavior. That means that you can get non-iolist data when you use ~s for printing an atom, but a 'badarg' when printing Unicode strings. That is inconsistent, and it delays error detection if the result is passed to a port or iolist_to_binary/1. 2. Always allow Unicode characters for ~s. That would be incompatible, because ~s says that any binary is encoded in latin1, while ~ts says that any binary is encoded in UTF-8. To implement this solution, we could no longer support latin1 binaries; all binaries would have to be encoded in UTF-8. 3. Only allow ~s for atoms where all characters are less than 256. Require ~ts to print atoms such as 'спутник'. We reject solution 1 because it is slightly incompatible and is inconsistent. We reject solution 2 because it too incompatible. Therefore, this commit implements solution 3.
2017-02-01Merge branch 'josevalim/atu8-chunk/PR-1078/OTP-14178'Björn Gustavsson
* josevalim/atu8-chunk/PR-1078/OTP-14178: Add new AtU8 beam chunk
2017-01-30Add new AtU8 beam chunkJosé Valim
The new chunk stores atoms encoded in UTF-8. beam_lib has also been modified to handle the new 'utf8_atoms' attribute while the 'atoms' attribute may be a missing chunk from now on. The binary_to_atom/2 BIF can now encode any utf8 binary with up to 255 characters. The list_to_atom/1 BIF can now accept codepoints higher than 255 with up to 255 characters (thanks to Björn Gustavsson).
2017-01-25Update test cases for erlang:hash/2 removalBjörn-Egil Dahlberg
2017-01-25stdlib: Produce correct warning for erlang:hash/2Björn-Egil Dahlberg
2017-01-17Merge branch 'maint'Björn-Egil Dahlberg
2017-01-17Merge branch 'egil/cuddle-tests' into maintBjörn-Egil Dahlberg
* egil/cuddle-tests: stdlib: Increase timetrap for rand_SUITE common_test: Increase timetrap for cth_hooks_SUITE compiler: Increase timetrap timeouts for lc_SUITE
2017-01-16Merge pull request #1307 from bjorng/bjorn/asn1/remove-deprecated/OTP-14146Björn Gustavsson
asn1: Remove deprecated functions OTP-14146
2017-01-13asn1: Remove deprecated functionsBjörn Gustavsson
Remove the entire asn1rt module. All functions in it were deprecated in OTP 17. In asn1ct, remove the deprecated functions asn1ct:encode/3 and asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been formally deprecated but is undocumented.
2017-01-13Merge branch 'hasse/stdlib/check_type_constraints/OTP-14070/PR-1214'Hans Bolinder
* hasse/stdlib/check_type_constraints/OTP-14070/PR-1214: stdilb: Check for bad type constraints in function types
2017-01-12Merge branch 'maint'Hans Bolinder
* maint: stdlib: Correct signatures of functions in erl_parse
2017-01-12Merge pull request #1303 from bjorng/bjorn/kernel-stdlib-docBjörn Gustavsson
Kernel/STDLIB: Remove references to OTP R12B and earlier
2017-01-11gen_{server,fsm}.xml: Remove superfluous reference to R12BBjörn Gustavsson
2017-01-11ets: Remove superfluous reference to R11BBjörn Gustavsson
2017-01-10stdlib: Correct signatures of functions in erl_parseHans Bolinder
The signatures of erl_parse:anno_to_term/1 and erl_parse:anno_from_term/1 are corrected. Using these function no longer results in false Dialyzer warnings.