[erlang-bugs] code:lib_dir/1 fails with ERL_LIBS set

Loïc Hoguin <>
Wed Jan 29 15:32:23 CET 2014

Two issues with your test.

ERL_LIBS is for specifying lib directories, that is, a directory that 
contains directories of applications. What you specify is a directory of 
an application directly. In your example the correct directory would be 

"/Users/vances/foo/ebin/bar.beam" should be 
"/Users/vances/bar/ebin/bar.beam", the bar application is expected to 
reside in a folder of the same name.

On 01/29/2014 03:27 PM, Vance Shipley wrote:
> There appears to be a bug where code:lib_dir/1 fails with applications
> appearing in an extra lib directory declared with ERL_LIBS.  The following
> shows the problem:
> $ ERL_LIBS=/Users/vances/foo erl
> Erlang R16B03 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
> Eshell V5.10.4  (abort with ^G)
> 1> application:load(bar).
> ok
> 2> code:which(bar).
> "/Users/vances/foo/ebin/bar.beam"
> 3> code:where_is_file("bar.app").
> "/Users/vances/foo/ebin/bar.app"
> 4> code:lib_dir(bar).
> {error,bad_name}

Loïc Hoguin

More information about the erlang-bugs mailing list