Patch for infinite loop in edoc

Taylor Venable taylor@REDACTED
Wed Feb 2 01:26:04 CET 2011


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,

-- 
Taylor C. Venable
http://metasyntax.net/


More information about the erlang-patches mailing list