Re: Suicide by module_info

Tuncer Ayaz <[email protected]> Sun, 26 Apr 2015 22:40:29 +0200
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAOvwQ4ijWZH3DJ_kiDjNR5ci8ipWerZsqOA+rhLUQ_JEkhbu0g@mail.gmail.com>
On Sun, Apr 26, 2015 at 10:19 PM, Steve Vinoski <[email protected]> wrote:
>
>
> On Sun, Apr 26, 2015 at 2:10 PM, Richard Carlsson
> <[email protected]> wrote:
> >
> > Here's a fun one!
> >
> > Erlang/OTP 18 [RELEASE CANDIDATE 1] [erts-7.0] [source-7ff8f81]
> > [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
> >
> > Eshell V7.0  (abort with ^G)
> > 1> c(foo).
> > {ok,foo}
> > 2> erlang:get_module_info(foo).
> > [{module,foo},
> >  ...]
> > 3> code:delete(foo).
> > true
> > 4> erlang:get_module_info(foo).
> > Segmentation fault (core dumped)
>
>
> Interestingly, the segv occurs as far back as R12B-5, which is the
> oldest release I have handy.

Could it be that erlang:get_module_info/1 is undocumented and
therefore underused? I don't think I ever called get_module_info/1 and
I suspect everyone just uses foo:module_info/0,1, which interestingly
works after a successful code:delete(foo) call.

The crash is a bug, but this might explain how it went unnoticed.

Do you think the following is the right behavior?

> c(foo).
{ok,foo}
> code:delete(foo).
true
> foo:module_info().
[{module,foo},
...]

I mean, I would expect fully qualified calls to foo:module_infi/0 to
fail once code:delete(foo) succeeds. Or is this how it's supposed to
behave?
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs