otp icon indicating copy to clipboard operation
otp copied to clipboard

Unicode filepaths and ERLC_USE_SERVER

Open garazdawi opened this issue 2 years ago • 3 comments

Describe the bug If I use a unicode filepath and have set ERLC_USE_SERVER=true then any compilation using the server will fail with "no such file or directory.

To Reproduce

export ERLC_USE_SERVER=true
echo "-module(t). -export([t/0]). t() -> ok." > "∑/t.erl"
erlc "∑/t.erl"
erlc "∑/t.erl"
∑/t.erl: no such file or directory

Expected behavior The second call to erlc should not fail.

Affected versions I've only tested 25, but probably exists since introduction of the compile server.

garazdawi avatar Aug 29 '22 06:08 garazdawi

The first call, will fail to connect to the compilation server and proceed to starting it but compile without the server. The second call will connect successfully to the compilation server and doing so it will encode the command line arguments into an Erlang term, among the functions ei_string_len is used which does not support unicode

frazze-jobb avatar Sep 13 '22 13:09 frazze-jobb

Can we change the protocol to the server to use binaries instead of strings? @bjorng ?

I'm assuming we do not want to add an ei_encode_string_as for sending unicode strings to an Erlang node...

garazdawi avatar Sep 14 '22 05:09 garazdawi

Yes, changing the protocol to use binaries instead of strings should be easy. It might be enough to do the change only in erlc. Glancing at erl_compile_server code, it seems that it can already handle binaries as well as strings.

bjorng avatar Sep 14 '22 06:09 bjorng

Fixed in #6306

garazdawi avatar Oct 25 '22 14:10 garazdawi