rb:show/1 problem

Ernie Makris <>
Sat Dec 4 23:24:43 CET 2004


>Folks,
>
>There is a problem with rb:show/1 in R10B which appears after you
>run it with an integer() argument.  It prints the report the first
>time but the next time it prints the error below.
>
> -Vance
>
>rb: ERROR! A report on bad form was encountered. It can not be printed
>to the log.
>
>Details:
>"2004-11-30 05:37:41" {{{2004,11,30},{5,37,41}},
>                       {info_report,<0.33.0>,
>                                    {<0.36.0>,
>                                     progress,
>                                     [{supervisor,{local,sasl_safe_sup}},
>                                     {started,
>                                         [{pid,<0.37.0>},
>                                           {name,alarm_handler},
>
{mfa,{alarm_handler,start_link,[]}},
>                                           {restart_type,permanent},
>                                           {shutdown,2000},
>                                           {child_type,worker}]}]}}}
>
>rb: Can not reopen standard_io. Logging aborted.

 Hello,

I too am having the same problem. R9C-1 seems to work fine. Calling rb:show
on the second time
produces the same error message as quoted above.
I looked at the code inside rb.erl and found that when handle_call is
serviced:
handle_call({show_number, Number}, _From, State) ->
    #state{dir = Dir, data = Data, device = Device, abort = Abort, log =
Log} = State,
    NewDevice = print_report(Dir, Data, Number, Device, Abort, Log),
    {reply, ok, State#state{device = NewDevice}};

The device is replaced with {proceed, standard_io}. In R9C-1 it is:
handle_call({show_number, Number}, _From, State) ->
    #state{dir = Dir, data = Data, device = Device} = State,
    catch print_report(Dir, Data, Number, Device),
    {reply, ok, State};

Notice in R9C-1 there is no Device replacement.

The problem arises when in format_lib_supp.erl:

print_header2(Device, Line, Header) ->
    Format1 = lists:concat(["~n~", Line, ".", Line, "s~n"]),
    Format2 = lists:concat(["~", Line, "c~n"]),
    io:format(Device, Format1, [Header]),
    io:format(Device, Format2, [$=]).

a call to print_header2 is made and io:format is passed {proceed,
standard_io} instead of
standard_io.

I have a fix, but I'm not sure if its proper. Here it is:
handle_call({show_number, Number}, _From, State) ->
    #state{dir = Dir, data = Data, device = Device, abort = Abort, log =
Log} = State,
    {Next, NewDevice} = print_report(Dir, Data, Number, Device, Abort, Log),
    {reply, ok, State#state{device = NewDevice}};

Since print_report now returns {XXXSOMETHINGXXX, Device}, I do the proper
match. However, I'm not
sure what should happen when {abort, Device} is returned?
If this is a bug, can it be fixed in the next release?

Thanks
Ernie




More information about the erlang-questions mailing list