Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  Inviso

Guest
Posted: Sat May 29, 2010 12:38 pm Reply with quote
Guest
Ulf Wiger suggested a cleanup of the 'inviso' application by tidier and
I've already done that. I'll submit a patch via github early next week.

Before starting, I've already noticed that dialyzer complains that:

inviso_tool.erl:586: The pattern {'error', Reason} can never match the
type {'ok',#ld{...}}

which refers to the init/1 function:

init(Config) ->
case fetch_configuration(Config) of % From conf-file and Config.
{ok,#ld{}=LD} ->
case start_inviso_at_c_node(LD) of
...
end;
{error,Reason} ->
{stop,{error,{start_up,Reason}}}
end.

due to the fact that fetch_configuration/1 returns {ok,...} in all its
branches -- even in the error case:

fetch_configuration(Config) ->
case fetch_config_filename(Config) of
{ok,FName} -> % We are supposed to use a conf-file.
case read_config_file(FName) of
{ok,LD} -> % Managed to open a file.
NewLD=read_config_list(LD,Config),
{ok,NewLD};
{error,_Reason} -> % Problem finding/opening file.
LD=read_config_list(#ld{},Config),
{ok,LD}
end;
false -> % No filename specified.
LD=read_config_list(#ld{},Config),
{ok,LD}
end.

Dialyzer is right, but the question is how should this one be fixed?
Simply by taking the {error,Reason} case from init/1 or by returning
{error,Reason} in the {error,Reason} case of fetch_configuration/1?

Kostis

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Sat May 29, 2010 6:43 pm Reply with quote
Guest
Some more confusion in inviso.

There is a record definition which reads:

%% The loopdata record.
-record(ld,{...
session_state=passive, % passive | tracing
...}).

leading one to believe that this field is to be assigned the values
'passive' or 'tracing'. Yet, on line 844 there is an assignment:

LD#ld{session_state=passive_sessionstate(),
nodes=NewNodesD,
....

The problem is that the definition of passive_sessionstate/0 reads
(comment is actually from the code - line 2962):

%% Returns the correct value indicating that the tool is not tracing.
passive_sessionstate() ->
idle.

Does anybody know which are the values that this field can have?

Kostis

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum