erlc (R9C) hangs when last line is is a comment missing EOL

Raimo Niskanen raimo@REDACTED
Fri Sep 19 09:44:58 CEST 2003


Here's a "diff -c" of the fix to be relased in R9C-1. There is also a 
fix on erl_pp that is not really necessary, but caused the hanging. This 
fix makes the scan's ok so the error in erl_pp is not triggered.

If this fix does not work, let me know.

/ Raimo Niskanen, Erlang/OTP, Ericsso AB



*** 
/clearcase/otp/erts/lib/stdlib/src/erl_scan.erl@@/main/release/r9c_otp_4787/0 
       Thu Aug 28 10:41:22 2003
--- 
/clearcase/otp/erts/lib/stdlib/src/erl_scan.erl@@/main/release/r9c_otp_4787/LATEST 
  Wed Sep  3 13:38:53 2003
***************
*** 558,564 ****
   scan_comment([_|Cs], Stack, Toks, Pos, State, Errors) ->
       scan_comment(Cs, Stack, Toks, Pos, State, Errors);
   scan_comment([], Stack, Toks, Pos, State, Errors) ->
!     more([], Stack, Toks, Pos, State, Errors, fun scan_comment/6).



--- 558,566 ----
   scan_comment([_|Cs], Stack, Toks, Pos, State, Errors) ->
       scan_comment(Cs, Stack, Toks, Pos, State, Errors);
   scan_comment([], Stack, Toks, Pos, State, Errors) ->
!     more([], Stack, Toks, Pos, State, Errors, fun scan_comment/6);
! scan_comment(Eof, _Stack, Toks, Pos, State, Errors) ->
!     done(Eof, Errors, Toks, Pos, State).


Chris Pressey wrote:
> On Thu, 18 Sep 2003 06:46:59 +0100
> Peter-Henry Mander <erlang@REDACTED> wrote:
> 
> 
>>I've seen this on SuSE 8.2 linux too. There's an easy work-around (-:
> 
> 
> How very pragmatic of you to suggest that :)
> 
> There are similar errors on these types of files with file:consult/1,
> file:eval/1, and erl_scan:string/1.
> 
> I think I located the problem: erl_scan:scan_comment/6 doesn't have a
> clause for when the first argument is just 'eof'.  I added one that
> calls done(Eof, [], Toks, Pos, eos), but it only has limited success
> (erl_scan:string/1 no longer crashes, but the other still do.)
> 
> -Chris
> 
> 
>>Chris Pressey wrote:
>>
>>>Try this:
>>>
>>>
>>>-module(blah).
>>>%%% BEGIN blah %%%
>>>-export([foo/0]).
>>>foo() -> bar.
>>>%%% END of blah %%%
>>>                   ^ do not include an EOL here.
>>>
>>>
>>># erlc foo.erl
>>><<indefinate hang>>
>>>
>>>This happens for me both on FreeBSD-4.9 PRERELEASE and Windows 98. 
>>>(Also, I can't seem to gracefully kill erlc on Windows 98 when this
>>>happens - Ctrl-C gives me the menu, but the 'a' option doesn't
>>>work.)
>>>
>>>This only seems to happen when the last line is a comment AND is
>>>missing an EOL.
>>>
>>>-Chris
>>>
>>>
>>
>>
> 
> 




More information about the erlang-questions mailing list