[erlang-patches] Patch for infinite loop in edoc

Niclas Axelsson <>
Wed Feb 2 17:14:39 CET 2011


On 02/02/2011 01:26 AM, Taylor Venable wrote:
> Hi, this is my first patch for Erlang/OTP and also my first time using
> Git, so hopefully I've done it OK. The command to fetch the patch is:
>
> git fetch git://github.com/metasyntax/otp.git edoc_loop_fix
>
> The change is simple: modify edoc_wiki:strip_empty_lines/2 to return
> when passed an empty list. This is the case when the end of the edoc
> comment is encountered after a starting ``` sequence, but before an
> ending ''' sequence. Without this patch, processing the following file
> with edoc triggers an infinite recursion in strip_empty_lines/2:
>
> ==== test.erl ====
> %% @doc start
> %% ```
>
> %% '''
> %% end
>
> -module(test).
> -export([foo/0]).
>
> foo() ->  ok.
> ==== END OF FILE ====
>
> This only affects using ``` because neither `` nor ` call
> strip_empty_lines/1. With this patch in place, this input file causes
> the same error behaviour that using `` or ` does:
>
> 2>  edoc:get_doc("test.erl").
> test.erl, in module header: at line 2: ```-quote ended unexpectedly at line 2
> ** exception exit: error
>       in function  edoc_tags:parse_tag/4
>       in call from edoc_tags:parse_tags/5
>       in call from edoc_extract:get_tags/5
>       in call from edoc_extract:source/4
>
> Thanks,
>
>    
Thanks Taylor.

I've included your branch into 'pu'.

Regards,
Niclas Axelsson, Erlang/OTP


More information about the erlang-patches mailing list