[Ecls-list] slime

Alessandro Serra gas.hale at gmail.com
Sat Jan 14 22:55:46 UTC 2012


Hi all,
I had a problem with the last version of slime (the one used by
quickload) and the cvs of ecl.
Ecl generates a memory condition in "cl-peek-char".
I fixed it adding the :element-type key to the socket-accept function
in the swank-ecl.lisp.

-----------------------------------------------------------------------------
 (defimplementation accept-connection (socket
                                      &key external-format
                                      buffering timeout)
  (declare (ignore timeout))
  (sb-bsd-sockets:socket-make-stream (accept socket)
                                     :output t
                                     :input t
                                     :buffering (ecase buffering
                                                  ((t) :full)
                                                  ((nil) :none)
                                                  (:line line))
                                     :external-format external-format
                                     :element-type '(unsigned-byte 8)))
------------------------------------------------------------------------

You can test the bug using the following code:

----------------
(defun accept-connection (socket)
  (sb-bsd-sockets:socket-make-stream
   (sb-bsd-sockets:socket-accept socket)
   :output t
   :input t
   :buffering :full
   :external-format nil
;   :element-type '(unsigned-byte 8)))
   ))

(defun resolve-hostname (name)
  (car (sb-bsd-sockets:host-ent-addresses
        (sb-bsd-sockets:get-host-by-name name))))

(defun create-socket ()
  (let ((socket (make-instance 'sb-bsd-sockets:inet-socket
			       :type :stream
			       :protocol :tcp)))
    (setf (sb-bsd-sockets:sockopt-reuse-address socket) t)
    (sb-bsd-sockets:socket-bind socket (resolve-hostname "127.0.0.1") 5000)
    (sb-bsd-sockets:socket-listen socket 1)
    socket))

(defun test ()
  (let ((socket (create-socket)))
    (format t "created~%")
    (let ((stream (accept-connection socket))
	  (length 5))
      (format t "accepted~%")
      (let* ((buffer (make-array length
				 :initial-element 0
				 :element-type '(unsigned-byte 8)))
	     (count (read-sequence buffer stream)))
	(format t "~A~%" buffer)))
    (sb-bsd-sockets:socket-close socket)))

(test)
---------------

Best Regards,
Alessandro

-- 
The basic tool for the manipulation of reality is the manipulation of
words. If you can control the meaning of words, you can control the
people who must use the words.
                   How To Build A Universe That Doesn't Fall Apart Two
Days Later
                   Philip K. Dick




More information about the ecl-devel mailing list