bug/feature in code_server.erl
Corrado Santoro
csanto@REDACTED
Thu Feb 9 13:49:30 CET 2006
But the "." dir is still in the path, and your current dir is
"/home/mbj/src". So, what's the problem here?
--Corrado
Martin Bjorklund wrote:
> Hi,
>
> code:del_path() doesn't behave as expected:
>
> nassa src> ls /home/mbj/src/a.beam
> /home/mbj/src/a.beam
>
> nassa src> erl -pa /home/mbj/src
> Erlang (BEAM) emulator version 5.4.10 [source] [hipe]
>
> Eshell V5.4.10 (abort with ^G)
> 1> code:get_path().
> ["/home/mbj/src",
> ".",
> "/home/mbj/src/otp_src_R10B-8/installed/lib/erlang/lib/kernel-2.10.11/ebin",
> <OTP dirs removed>
>
> 2> code:del_path("/home/mbj/src").
> true
> 3> code:which(a).
> non_existing
> 4> code:load_file(a).
> {module,a}
> 5> code:which(a).
> "/home/mbj/src/a.beam"
>
> 6> code:get_path().
> [".",
> "/home/mbj/src/otp_src_R10B-8/installed/lib/erlang/lib/kernel-2.10.11/ebin",
> <OTP dirs removed>
>
>
>
> In 1. we see that /home/mbj/src is in the path
> In 2. /home/mbj/src is deleted
> In 3. we can see that a.beam is not found in the path
> In 4. we can still load a.beam, from /home/mbj/src, although
> /home/mbj/src is not in the path.
>
>
> [browsing code_server.erl...]
>
> The problem is in code_server:mod_to_bin's last clause:
>
> mod_to_bin([], Mod) ->
> %% At last, try also erl_prim_loader's own method
> File = code_aux:to_path(Mod) ++ code_aux:objfile_extension(),
> case erl_prim_loader:get_file(File) of
>
> And it turns out that /home/mbj/src is in erl_prim_loader's path,
> since it was added with -pa.
>
> But why is this clause here? code_server grabs the path from
> erl_prim_loader at startup, and after that code should be loaded
> according to the path in code_server.
>
> The workaround for me is to clear erl_prim_loader's path.
>
>
>
> /martin
>
--
======================================================
Eng. Corrado Santoro, Ph.D.
University of Catania - Engineering Faculty
Department of Computer Science and
Telecommunications Engineering
Viale A. Doria, 6 - 95125 CATANIA (ITALY)
Tel: +39 095 7382380
+39 095 7387035
+39 095 7382365
+39 095 7382364
VoIP: sip:7035@REDACTED
Fax: +39 095 7382397
EMail: csanto@REDACTED
Personal Home Page:
http://www.diit.unict.it/users/csanto
NUXI Home Page:
http://nuxi.diit.unict.it
======================================================
More information about the erlang-questions
mailing list