[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-hackers] Bug in socket egg read-line, fix diff attached

From: Jonathan Chan
Subject: [Chicken-hackers] Bug in socket egg read-line, fix diff attached
Date: Sun, 06 Jul 2014 16:55:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0


First of all, thanks again for the useful eggs and Scheme implementation. I was trying to write a script using the intarweb egg and ran into a problem where read-line on a socket would return a number instead of a string. I looked into it and believe I have found a fix, which is attached.

The problem had two parts: first, socket's implementation of read-line returned the result of a call to ##sys#scan-buffer-line, which returns multiple values, whereas read-line seems to be supposed to return only the string that was read. Second, the bufindex variable representing the position within the socket was updated within the eos-handler lambda, although it is possible for the eos-handler procedure to never be called within ##sys#scan-buffer-line. To fix the bug all that is needed is to unpack the values returned from ##sys#scan-buffer-line and use those to set the buffer index then return.

  Jonathan Chan

Attachment: fix_socket_read_line.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]