[erlang-questions] symlink error (I think)

Bengt Kleberg bengt.kleberg@REDACTED
Mon Apr 15 12:56:23 CEST 2013


Greetings,

This is a case of "read all of the documentation to understand a part of
it". For read_link_info/1-2 it says that it is different from
read_file_info/1-2 because read_link_info/1-2 can get "the type field of
the record will be set to symlink". 

If read_file_info/1-2 could have symlink then there would be no
difference.

It would definitely be better if read_file_info/1-2 also mentioned this.


bengt

On Mon, 2013-04-15 at 12:28 +0200, Joe Armstrong wrote:
> 
> 
> I tried this on ubuntu as well:
> 
> test() ->
>     File = "/home/ejoearm/work/bugs/share",
>     {ok, X1} = file:read_file_info(File),
>     {ok, X2} = file:read_link_info(File),
>     {X1#file_info.type, X2#file_info.type}.
> 
> 
> > bug:test().
> {directory,symlink}
> 
> 
> So read_file_info does follow symlinks. But the man page says it can
> return type
> symlink. Is this a bug in the manual page? Or have I misunderstood
> something.
> 
> 
> /Joe
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Mon, Apr 15, 2013 at 11:51 AM, Jon Schneider
> <jon@REDACTED> wrote:
>         > I believe file:read_file_info/1,2 will "follow" symlinks and
>         give you
>         > information
>         
>         
>         Clearly there's a job to decide what these functions are
>         _supposed_ to do
>         exactly and fix code and documentation.
>         
>         Jon
>         
>         
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list