Re: Correct ls/1 in c.erl

Björn Gustavsson <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <CA+yh78Tm8AtFhdiAVHkHh4YG5ak8=tGM9jS9Hc9k9eyxDA-0Vw@mail.gmail.com>
We found the idea of improving c:ls/1 worthwhile.

Therefore, we will not simply reject the patch.

Instead we will use the implementation in the following
commit:


https://github.com/bjorng/otp/commit/67d83e15fdee068217df7f14a32fb901d7d4d91b

in which I have credited Bengt for the idea and test case.

We will test it a few days in our daily builds before merging
it to maint.

/Bjorn



On Mon, May 20, 2013 at 4:40 PM, Bengt Kleberg
<[email protected]>wrote:

> I do not know why file:list_dir/1 has failed with {error, enoent}.
> Or to be precise, I do not know what failure with {error, enoent} means
> for the different cases I get from directories, files, links, special
> files, none-existing files and the combination of read/no-read access
> for these.
>
>
> bengt
>
> On Mon, 2013-05-20 at 16:36 +0200, Björn Gustavsson wrote:
> > I'll try to clarify my question:
> >
> >
> >
> > Why test for existence at all if
> > file:list_dir/1 has already told you that the
> > file exists?
> >
> >
> > On Mon, May 20, 2013 at 4:22 PM, Bengt Kleberg
> > <[email protected]> wrote:
> >
> >
> >         The filelib:is_dir/is_file/is_regular functions confuse me. I
> >         am unsure
> >         what they will return for directories, files, links, special
> >         files,
> >         none-existing files and the combination of read/no-read access
> >         for
> >         these.
> >
> >         file:read_link_info/1 is more predictable.
> >
> >
> >         bengt
> >
> >         On Mon, 2013-05-20 at 15:59 +0200, Björn Gustavsson wrote:
> >         > On Mon, May 20, 2013 at 1:45 PM, Bengt Kleberg
> >         > <[email protected]> wrote:
> >         >         6> file:list_dir("nosuchfile").
> >         >         {error,enotdir}
> >         >
> >         >         I think to use file:read_link_info/1 to establish
> >         the
> >         >         existence of the
> >         >         file/directory.
> >         >
> >         > Why?
> >         >
> >         >
> >         > If file:list_dir(Name) returns {error,enotdir}, it means
> >         that
> >         > there exists a file named Name (but it is not a directory).
> >         >
> >         >
> >         > If no such file exists, the return value will be
> >         {error,enoent}.
> >         >
> >         >
> >         > In what situation would it be useful to call
> >         > file:read_link_info/1?
> >         >
> >         >
> >         >
> >         > --
> >         > Björn Gustavsson, Erlang/OTP, Ericsson AB
> >
> >
> >
> >
> >
> >
> > --
> > Björn Gustavsson, Erlang/OTP, Ericsson AB
>
>


-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB

_______________________________________________
erlang-patches mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.