problem with filelib:fold_files/5

Raimo Niskanen raimo@REDACTED
Fri Sep 24 09:10:03 CEST 2004


That seems to correct the wrong bug, that is, the fix on line 46.

The documentation for filelib:is_file/1 says that it should return 'true'
iff the file is 'regular' or 'directory', so the test for 'directory' is
missing in your fix.

Later, however, in filelib:fold_files/6, is_file/1 is used as if it
was defined according to your fix, so fold_files/6 also has to be
rewritten according to the documented behaviour of is_file/1. I dare
not change that strange but documented behaviour.

To the next release (or maybe now) I will probably add is_regular/1 to
filelib.

I think the fix on lines 87 to 89 is correct.



erlang-list@REDACTED (Dominic Williams) writes:

> Le 9 sept. 04, à 17:09, Chris Pressey a écrit :
> 
> > Not at all, Dominic Williams reported this bug in February:
> >
> > http://www.erlang.org/ml-archive/erlang-questions/200402/msg00029.html
> >
> > and I reported it a year ago:
> >
> > http://www.erlang.org/ml-archive/erlang-questions/200309/msg00198.html
> 
> Indeed.
> 
> Here's a patch (there are actually two distinct bugs):
> 
> 46c46
> <       {ok, _} ->
> ---
>  >       {ok, #file_info{type=regular}} ->
> 87c87,89
> <     end.
> ---
>  >     end;
>  > fold_files([],_,_,_,_,Acc) ->
>  >     Acc.
> 
> Cheers,
> 
> Dominic Williams
> http://www.dominicwilliams.net
> ----
> 
> Dominic Williams
> http://www.dominicwilliams.net
> ----
> 

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list