Now files that end in a newline return an empty string on the last
iteration. (I'm not sure if that's correct.) That looks to be at least
partially to blame for this code's bus error on os x:

 .sub main @MAIN
     $P0 = open "test.pir", "<"
   LOOP:
     unless $P0 goto END
     $S0 = readline $P0
     $S1 = substr $S0, -1, 1
     if $S1 != "\n" goto LOOP
     goto LOOP
   END:
     end
 .end

(Make sure you save it with a newline after ".end".) If you s/-1,
1/-1/, it works (This may be related to #33747). It will also work if
you insert "unless $S0 goto END" after the readline.

-- 
matt diephouse
http://matt.diephouse.com

On Sun, 9 Jan 2005 15:51:32 +0100, Leopold Toetsch <[EMAIL PROTECTED]> wrote:
> Matt Diephouse <[EMAIL PROTECTED]> wrote:
> 
> > The following code segfaults when data.txt contains one line of text
> > with no newline.
> 
> Thanks for reporting, fixed.
> 
> leo
>

Reply via email to