[erlang-questions] Bug in code_server:del_path

Vlad Dumitrescu <>
Thu Aug 2 22:32:31 CEST 2007


Hi!

For code:add_path* and code:replace_path, the code_server
implementation first applies a filename:join to the directory name,
normalizing it.

The implementation of del_path doesn't do the same, making it
impossible to remove paths that aren't already normalized (for example
if the drive letter in Windows is uppercased).

I couldn't test extensively, but I believe that the following change
will fix that.

delete_name_dir(Dir, Db) ->
    case get_name(Dir) of
	Dir  -> false;
	Name ->
-	    Dir0 = del_ebin(Dir),
+	    Dir0 = del_ebin(filename:join([Dir])),
	    case lookup_name(Name, Db) of
		{ok, Dir0} ->
		    ets:delete(Db, Name),
		    true;
		_ -> false
	    end
    end.

BTW, there is a code_server:normalize/1 function, why isn't that one
used for normalization?

best regards,
Vlad



More information about the erlang-questions mailing list