[erlang-bugs] Non-ASCII $HOME crashed distributed Erlang on OS X

pan@REDACTED pan@REDACTED
Thu Jul 19 15:56:50 CEST 2012


Hi!

On Thu, 19 Jul 2012, Emile Joubert wrote:

> Hi,
>
> I'm unable to start a distributed Erlang node on OS X when the $HOME
> directory contains non-ASCII characters. Is there some aspect of my
> environment that I need to change or is this a bug in Erlang (I'm using
> R15B)? Here is a transcript that demonstrates:
>
> uname -v
> Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010;
> root:xnu-1504.7.4~1/RELEASE_I386
>
> locale
> LANG="en_GB.UTF-8"
> LC_COLLATE="en_GB.UTF-8"
> LC_CTYPE="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME="en_GB.UTF-8"
> LC_ALL=
>
> echo $HOME
> /tmp/ÿÿAÿÿ
>
> erl -sname foo
> {error_logger,{{2012,7,19},{11,33,22}},"Failed to create cookie file",[]}
> {error_logger,{{2012,7,19},{11,33,22}},crash_report,[[{initial_call,{auth,init,['Argument__1']}},{pid,<0.18.0>},{registered_name,[]},{error_info,{exit,{"Failed
> to create cookie
> file",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,297}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,321}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},{ancestors,[net_sup,kernel_sup,<0.9.0>]},{messages,[]},{links,[<0.16.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,610},{stack_size,24},{reductions,548}],[]]}
> {error_logger,{{2012,7,19},{11,33,22}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{"Failed
> to create cookie
> file",[{auth,init_cookie,0,[{file,"auth.erl"},{line,285}]},{auth,init,1,[{file,"auth.erl"},{line,139}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,297}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},{offender,[{pid,undefined},{name,auth},{mfargs,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
> {error_logger,{{2012,7,19},{11,33,22}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]}
> {error_logger,{{2012,7,19},{11,33,22}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
> {"Kernel pid
> terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}

Yes, that's a reproducable bug allright. The environment  variable is in 
UTF8 and a *list* with UTF8 characters is passed to the file operation 
instead of a binary (or a list of unicode codepoints, which would also 
have worked)

Could you try the following source patch on kernel/auth.erl:
-----------------8><-----------------------------
*** auth.erl.old        2012-07-18 20:11:07.000000000 +0200
--- auth.erl    2012-07-19 15:52:57.000000000 +0200
***************
*** 298,304 ****
   read_cookie() ->
       case init:get_argument(home) of
         {ok, [[Home]]} ->
!           read_cookie(filename:join(Home, ".erlang.cookie"));
         _ ->
             {error, "No home for cookie file"}
       end.
--- 298,304 ----
   read_cookie() ->
       case init:get_argument(home) of
         {ok, [[Home]]} ->
!           read_cookie(filename:join(list_to_binary(Home), ".erlang.cookie"));
         _ ->
             {error, "No home for cookie file"}
       end.
-----------------8><-----------------------------
- and report back if that fixes your problem?

Cheers,
/Patrik

>
>
> -Emile
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>


More information about the erlang-bugs mailing list