erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.38k stars 2.95k forks source link

ERL-195: Invalid code:priv_dir/1 return value in some cases when -pa is used #3385

Closed OTP-Maintainer closed 3 years ago

OTP-Maintainer commented 8 years ago

Original reporter: essen Affected version: OTP-19.0 Fixed in version: OTP-19.1 Component: kernel Migrated from: https://bugs.erlang.org/browse/ERL-195


I run into an issue when using -pa and code:priv_dir/1 with Erlang 19.0. An example is worth a thousand words:

{code}$ erl -pa ./test_c_src_nif/ebin
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.0  (abort with ^G)
1> code:priv_dir(test_c_src_nif).
"./test_c_src_nif/priv"

$ erl -pa test_c_src_nif/ebin
Erlang/OTP 19 [erts-8.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V8.0  (abort with ^G)
1> code:priv_dir(test_c_src_nif).
"test_c_src_nif/ebin/priv"{code}

Considering -pa takes paths I'd expect them to be resolved the same with or without the dot segment.
OTP-Maintainer commented 8 years ago

essen said:

Are you sure about these versions? I don't see the issue with 18.3.1 or 18.2.2 at least.
OTP-Maintainer commented 8 years ago

egil said:

Ah, I misunderstood the issue. Reading hastily I thought it was the "." and not "ebin" that was an issue. I completely missed "ebin" at first.
OTP-Maintainer commented 8 years ago

peppe said:

Thanks for the report! A fix for this will be released in OTP 19.1.