quicklisp-client icon indicating copy to clipboard operation
quicklisp-client copied to clipboard

SBCL(Windows) Local projects

Open tgutu opened this issue 13 years ago • 0 comments

Recently I was having trouble loading my local quicklisp projects in the sbcl windows port.

(ql:quickload :clunit)

Signaled the following error (likewise for all local projects):

(SB-IMPL::SIMPLE-FILE-PERROR
 "failed to find the TRUENAME of ~A"
 #P"C:/Users/Marco/quicklisp/local-projects/clunit/clunit.asd
"
 2)

It seemed strange that the pathname looked correct but could not be found. Upon closer inspection I realized that the pathname had a trailing newline.

I backtraced the QUICKLOAD call and found my way into the QUICKLISP-CLIENT:FIND-SYSTEM-IN-INDEX function. After a little messing around I was able to trace the problem back to the READ-LINE function.

The READ-LINE function should not return trailing newlines but in the SBCL windows port it does

(with-input-from-string  (stream "line1
line2
line3
")
    (loop :for line = (read-line stream nil)
        :while line
        :collect line))
=>
("line1
" "line2
" "line3
")

This can be fxed by deleting #\RETURN:

(with-input-from-string  (stream "line1
line2
line3
")
    (loop
        :for line = (read-line stream nil)
        :while line
        :collect (delete #\return line)))
=> ("line1" "line2" "line3")

I have reported the issue, but apparently the nonUNIX newline format has been a long standing issue so I don't know when that will be fixed. And since not everyone will auto update to the new windows SBCL port if there is a fix anyway I suggest the following change:

(defun find-system-in-index (system index-file)
  "If any system pathname in INDEX-FILE has a pathname-name matching
SYSTEM, return its full pathname."
  (with-open-file (stream index-file)
    (loop for namestring =  #-sbcl (read-line stream nil) #+sbcl (delete #\return (read-line stream nil))
          while namestring
          when (string= system (pathname-name namestring))
          return (truename (merge-pathnames namestring index-file)))))

All my local projects now load just fine.

tgutu avatar Nov 08 '12 07:11 tgutu