problem with filelib:fold_files/5
Tobias Lindahl
tobias.lindahl@REDACTED
Thu Sep 9 11:48:59 CEST 2004
Hi Bengt!
I recently discovered this bug in filelib.erl by using Dialyzer but I did
not get around to reporting it. The problem is that filelib:fold_files/6
do not have a leaf-case for when the list of files ends. It seems that you
are the first person ever to use the function ;)
Tobias
On Thu, 9 Sep 2004, Bengt Kleberg wrote:
> greetings,
>
> the following crash has me baffled. does anybody see what kind of
> mistake i am making to create this crash?
>
> i am using SunOS 5.8 and
> Erlang (THREADS,HIPE) (BEAM) emulator version 5.3.6.3
>
>
> 1> Fun = fun( Cfile, Acc ) ->
> io:fwrite( "Cfile: ~s~n", [Cfile] ),
> io:fwrite( "Acc: ~w~n", [Acc] ),
> [Cfile|Acc]
> end,
> Regexp = regexp:sh_to_awk( "*" ),
> filelib:fold_files( "tmp", Regexp, false, Fun, [] ).
>
> Cfile: tmp/a.c
> Acc: []
> Cfile: tmp/subtmp.beam
> Acc: [[116,109,112,47,97,46,99]]
> Cfile: tmp/inc.hrl
> Acc:
> [[116,109,112,47,115,117,98,116,109,112,46,98,101,97,109],[116,109,112,47,97,46,99]]
> Cfile: tmp/subtmp.erl
> Acc:
> [[116,109,112,47,105,110,99,46,104,114,108],[116,109,112,47,115,117,98,116,109,112,46,98,101,97,109],[116,109,112,47,97,46,99]]
> Cfile: tmp/cnh2
> Acc:
> [[116,109,112,47,115,117,98,116,109,112,46,101,114,108],[116,109,112,47,105,110,99,46,104,114,108],[116,109,112,47,115,117,98,116,109,112,46,98,101,97,109],[116,109,112,47,97,46,99]]
>
> =ERROR REPORT==== 9-Sep-2004::11:20:56 ===
> Error in process <0.31.0> with exit value:
> {function_clause,[{filelib,fold_files,[[],"tmp",{concat,{concat,bos,{kclosure,{comp_class,"\n"}}},eos},false,#Fun<erl_eval.12.41869059>,["tmp/cnh2","tmp/subtmp.erl","tmp/inc.hrl","tmp/subtmp.beam","tmp/a.c"]]},{erl_eval,do_apply,5},{shell,eval_loop,2}]}
>
> ** exited: {function_clause,[{filelib,fold_files,
> [[],
> "tmp",
> {concat,
> {concat,
> bos,
>
> {kclosure,{comp_class,"\n"}}},
> eos},
> false,
> #Fun<erl_eval.12.41869059>,
> ["tmp/cnh2",
> "tmp/subtmp.erl",
> "tmp/inc.hrl",
> "tmp/subtmp.beam",
> "tmp/a.c"]]},
> {erl_eval,do_apply,5},
> {shell,eval_loop,2}]} **
>
More information about the erlang-questions
mailing list