[erlang-questions] [ANN] geas 2.0.10

Frank Muller frank.muller.erl@REDACTED
Sun Jan 8 16:29:45 CET 2017


Hi Eric,

I think I was able to understand the bug (in geas.erl):

get_src_from_beam(File) ->    UpperDir =
filename:dirname(filename:dirname(File)),
       Basename = filename:rootname(filename:basename(File)),
                           case string:substr(Basename,
string:len(Basename) -3 ) of  %% <— bug's here as the module name is only 3
chars. In this case: "dir.erl"
                                "_dtl" -> SrcDir = filename:join(UpperDir,
"templates"),
                                          Dtl = string:substr(Basename, 1,
string:len(Basename) -4 ),
                                          filename:join([SrcDir, Dtl ++
".dtl"]);
                                _      -> SrcDir = filename:join(UpperDir,
"src"),
                                          filename:join([SrcDir, Basename,
".erl"])
                           end.


You're substracting -3 from the module's basename length.
Because my module is called "dir.erl" (only 3 chars), this returns 0.

Then, call to string:substr/2 crashes because second argument must be > 0.

Hope this helps.
/Frank

Le sam. 7 janv. 2017 à 21:55, PAILLEAU Eric <eric.pailleau@REDACTED> a
écrit :

> Hi Franck,
>
>
>
> did you finally solved your problem ?
>
> because no issue opened...
>
>
>
> My main concern is to propose quality projects,
>
> so an issue always interest me !
>
>
>
> you are welcome !
>
> Regards
>
>
>
>
>
>
>
> Le 31/12/2016 à 15:51, Frank Muller a écrit :
>
> > Yes I did compile my project first.
>
> > All the .beam are in ./ebin and deps/*/ebin.
>
> >
>
> > Ok for the ticket on GitHub.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170108/e50f52a0/attachment.htm>


More information about the erlang-questions mailing list