[erlang-questions] list_to_pid() surprise

Anders Dahlin <>
Fri Feb 27 16:58:32 CET 2009


You are running a non-distributed node. The pid looks like it belongs to
a distributed node. Seems like only known/real "pid prefixes" are allowed.

()23> rpc:call(P, erlang, whereis, [global_name_server]).
<6440.11.0>
()24> list_to_pid(pid_to_list(v(-1))).
<6440.11.0>
()25> list_to_pid("<42.11.0>").
** exception error: bad argument
     in function  list_to_pid/1
        called as list_to_pid("<42.11.0>")
()26> list_to_pid("<6440.42.0>").
<6440.42.0>

/A

Ulf Wiger wrote:
> I'm not sure whether to report this as a bug (perhaps there's
> a good reason for it...?)
> 
> Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe] [kernel-poll:false]
> ...
> 11> pid_to_list(hd(v(6))).
> "<8288.15785.86>"
> 12> list_to_pid(pid_to_list(hd(v(6)))).
> ** exception error: bad argument
>      in function  list_to_pid/1
>         called as list_to_pid("<8288.15785.86>")
> 
> If this is intentional, can someone explain why?
> 
> BR,
> Ulf W



More information about the erlang-questions mailing list