Age | Commit message (Collapse) | Author |
|
|
|
When reporting a field redefinition in a record, erl_lint can forget
about some old unused variables.
f() -> X = 1, #r{a=foo,a=bar,a=qux}.
|
|
Variables used in the body of a try expression were marked as unsafe
*and* used, which makes no sense as an unsafe variable can't be used.
Function vtsubtract/2 is used to forget usage of such unsafe variables.
Reported-by: Paul Davis
|
|
When analyzing complex expressions (i.e. comprehensions, cases, tries,
ifs and receives), erl_lint does not forget about old unused variables
when returning the updated variable table. This causes a bug where old
unused variables are not recorded as such:
t(X, Y) ->
#r{a=[ K || K <- Y ],b=[ K || K <- Y ]}.
As erl_lint uses vtmerge_pat/2 to merge the results of the analysis of
the two list comprehensions, X is marked as used and the warning is not
emitted.
The function vtmerge_pat/2 is used instead of the similar vtmerge/2
which does not mark multiple occurrences of a variable as usage to
handle cases like the following one:
t(X, Y) ->
#r{a=A=X,b=A=Y}.
Other simpler expressions like conses, tuples and external fun
references do not correctly follow this behaviour, e.g. A is not marked
as used in the following code:
t(X, Y) ->
{A=X,A=Y}.
This commit fixes both issues and makes erl_lint not return old unused
variables in updated tables and makes all compound expressions use
vtmerge_pat/2.
Reported-by: Anders Ramsell
|
|
* hb/stdlib/dets_bugfix/OTP-11245:
Fix a Dets bug concerning traversal of tables
|
|
If the fun M:F/A construct was used erroneously the linter could
crash.
Thanks to Mikhail Sobolev for reporting the bug.
|
|
The bug was introduced in R16B.
Thanks to Manuel Durán Aguete.
|
|
|
|
* pan/unicode_error_wrong_offset:
Fix faulty rest on error in unicode:characters_to_list
OTP-11080
|
|
* rickard-sverker/carrier-migration/OTP-10279:
stdlib: Fix ets_SUITE memory tests
|
|
Need to take 'mbcs_pool' into account.
|
|
* nox/erl_pp-callback/OTP-11140:
Update primary bootstrap
Support callback attributes in erl_pp
|
|
|
|
|
|
In an email to erlang-questions, Bengt Kleberg wrote:
When I use c:ls/1 it reminds me so much of Unix "ls" that I
expect c:ls("filename") to work. The resulting error surprises
me every time (not the same day).
While teaching c:ls/1 to show non-directory files, update the
error handling to make use of the POSIX error codes from
file:list_dir/1 and file:format_error/1 (which had not been
invented when the c module was first implemented).
Suggested-by: Bengt Kleberg
Test-suite-by: Bengt Kleberg
|
|
* siri/cuddle-with-tests:
Fix gen_server_SUITE:call_with_huge_message_queue
Fix zip_SUITE:borderline test
|
|
Thanks to Tomáš Janoušek.
|
|
* sverk/ets-test-cuddle:
stdlib: Make memcheck in ets_SUITE less sensitive
|
|
* nox/fix-epp-file-attrs/OTP-11079:
Fix an inconsistent state in epp
|
|
This test always fails when gen is native compiled, since the
optmization is not implemented then. The test is now skipped when
running with hipe.
The test does also quite often fail on one of the test hosts which
runs in a virtual machine. The reason is that the clock runs "in
bursts" on this host, which is outside of the control of the erlang VM
and probably due to the fact that the host runs as a virtual
machine. To overcome this problem, the echo message is now sent 10000
times instead of 10 times - i.e. the test run is prolonged in order to
even out the effect of the bursts.
|
|
|
|
This test fails on a test host where no proper unix unzip is
installed. This has been corrected.
|
|
This function is used all over the place in OTP itself and people
sometimes want that functionality, they may as well not reimplement it
themselves.
|
|
When entering a new file, epp doesn't properly set #epp.name2 like it
does on initialisation, generating a malformed file attribute when it
leaves the file.
|
|
|
|
* bjorn/fix-encoding/OTP-11041:
Encode Erlang source files with non-ascii characters in UTF-8
|
|
To ensure that 'master' compiles when we merge 'maint' to it,
regardless of which encoding is default in 'master', all source
files with non-ascii characters *must* have the encoding specified.
|
|
|
|
* sverk/dets_remove_test_otp_9607:
stdlib: Fix unstable testcase ets_SUITE:delete_large_named_table
stdlib: Remove obsolete testcase dets_SUITE:otp_9607
|
|
* sv/stdlib/sys-get-state/OTP-11013:
Removed ?line macro
add sys:get_state/1,2 and sys:replace_state/2,3
update sys:get_status/2,3 documentation for gen_event
|
|
In rest_for_one and one_for_all supervisors one child dying can cause
multiple children to be restarted. Previously if the child that caused
the restart is started successfully but another child fails to start,
the supervisor would not terminate this child with the other
successfully restarted children as no record of the pid was kept. Thus
the supervisor would try to start this child again. This could lead to
multiples of the same child or if the child is registered cause repeated
attempts at starting this child - until the max restart threshold was
reached.
Now the child that failed to start becomes the restarting child, instead
of staying with the same child, for the next restart attempt. This has
the following side effects:
1) In one_for_all the new version of the child that original died is
terminated before a restart attempt is made.
2) In rest_for_one all succesfully restarted children are not terminated
and restarting continues from the child that failed to start.
|
|
|
|
|
|
At Erlang Factory 2013 there was discussion during one of the talks about
the sys:get_status functions and how useful they were for debugging. Geoff
Cant mentioned it would be very useful if the sys module also provided
functions to use while debugging to get just the state of a process and
also to be able to replace the state of a process, and many others in the
audience appeared to agree.
The sys:get_state/1,2 functions return the state of a gen_server, gen_fsm,
or gen_event process. The return value varies depending on the process
type: process state for a gen_server, state name and state data for a
gen_fsm, and handler module, handler id, and handler state for each handler
registered in a gen_event process.
The sys:replace_state/2,3 functions allow the state of a gen_server,
gen_fsm, or gen_event process to be replaced with a new state. These
functions take a function argument that updates or replaces the process
state; using a function to change the state eliminates the race condition
of first reading the state via sys:get_state/1 or sys:get_state/2, using
its return value to create a new state, and then replacing the old state
with the new state, since during that time the process might have received
other calls or messages that could have changed its state.
* For a gen_server process, the state replacement function takes the
process state as an argument and returns a new state.
* For a gen_fsm process, the state replacement function gets a tuple of
{StateName, StateData} and returns a similar tuple that specifies a new
state name, new state data, or both.
* For a gen_event process, the state replacement function is called for
each registered event handler. It gets a tuple {Module, Id, HandlerState}
and returns a similar tuple that specifies the same Module and Id values
but may specify a different value for HandlerState.
If the state replacement function crashes or results in an error, the
original state of a gen_server or gen_fsm process is maintained; if such a
crash occurs for a gen_event process, the original state of the event
handler for which the state replacement function was called is maintained,
but the states of other event handlers of the same gen_event process may
still be updated if no errors or crashes occur while replacing their
states.
Add documentation for sys:get_state/1,2 and sys:replace_state/2,3. The
documentation explicitly notes that the functions are intended for use
during debugging.
Add new tests for these functions to gen_server_SUITE, gen_fsm_SUITE, and
gen_event_SUITE.
|
|
A bug has been fixed: when given the option {encoding,utf8} a list of
floating point numbers (in the correct interval) was mistakenly
returned as a string.
|
|
The scanner did not crash when a floating point number was encountered
in the input string.
|
|
Remove the call trace from this testcase as we cannot guarantee named
table to be gone until ets:delete returns anyway.
|
|
|
|
* dgud/testcase_fixes:
Fix timers
mnesia: Decrease test times
Add debug printouts
wx: Fix failing testcases
stdlib: Ignore symlink tests on windows
|
|
The manual says that an Emacs directive can be placed on the second
line. With this patch that directive is also recognized when selecting
encoding of the script.
|
|
shell_SUITE: Calling i() did not work because if there are more than
100 processes c:i() will go into pager mode, asking for input.
|
|
io_proto_SUITE: node names containing some '-' did not work.
|
|
|
|
The test case deletes a Dets process while it is repairing a file.
Another client waiting for the Dets process to reply then kicks in and
repairs the file. Apparently the temporary file was still open,
resulting in an eacces error on Windows.
|
|
|
|
|
|
Symlinks only partially works on windows 7, ignore those tests
on windows machines for now
|
|
|
|
* pan/unicode_printable_ranges:
Adapt stdlib tests to ~tp detecting latin1 binaries
Update primary bootstrap
Make wx debugger use +pc flag when applicable
Correct misspelled comments and space at lin ends
Make ~tp output latin1 binaries as strings if possible
Leave the +pc handling to io and io_lib_pretty
Remove newly introduced warning in erlexec.c
Make shell_SUITE:otp_10302 use +pc unicode when needed
Fix io_proto_SUITE to handle the new io_lib_pretty:print
Add testcase for +pc and io:printable_range/0
Make printing of UTF-8 in binaries behave like lists.
Document +pc flag and io:printable_range/0
Add usage of and spec for io:printable_range/0
Add +pc {latin1|unicode} switch and io:printable_range/0
Fix some Unicode issues
OTP-18084
|
|
|