melisgl / mgl-pax

Documentation system, browser, generator.
https://melisgl.github.io/mgl-pax-world/
MIT License
75 stars 13 forks source link

Checking that pathname-name is a string #25

Closed Yehouda closed 1 year ago

Yehouda commented 1 year ago

https://github.com/melisgl/mgl-pax/blob/79fa2f7399a901ee743ac28c59cf6ee03a21cfde/src/web/web.lisp#L128

When trying (ql:quickload "mgl-pax/web") I get an error because it calls alexandria:starts-with-subseq with :unspecific, which is a valid value in pathname-name (and is the value when it is a directory).

I can fix it by changing this line to:

(unless (let ((name (pathname-name file)))
                  (and (stringp name )
                      (alexandria:starts-with-subseq "README" name)))
melisgl commented 1 year ago

Looks reasonable to me, but how do I reproduce this? I'd like to write a test.

What Lisp implementation is this? Also, what do the below forms evaluate to on your system?

CL-USER> (asdf:system-relative-pathname :mgl-pax "web/")
#P"/home/melisgl/own/mgl-pax/web/"
CL-USER> (uiop:directory*
          (merge-pathnames "*.*"
                           (asdf:system-relative-pathname :mgl-pax "web/")))
(#P"/home/melisgl/own/mgl-pax/web/README"
 #P"/home/melisgl/own/mgl-pax/web/README~"
 #P"/home/melisgl/own/mgl-pax/web/jquery.min.js"
 #P"/home/melisgl/own/mgl-pax/web/style.css"
 #P"/home/melisgl/own/mgl-pax/web/toc.min.js"
 #P"/home/melisgl/own/mgl-pax/web/xcharter/"
 #P"/home/melisgl/own/mgl-pax/web/xeb-garamond/")
Yehouda commented 1 year ago

Lispworks 64bit on Freebsd:


CL-USER 51 > (asdf:system-relative-pathname :mgl-pax "web/")
(asdf:system-relative-pathname :mgl-pax "web/")
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/"

CL-USER 52 >  (uiop:directory*
          (merge-pathnames "*.*"
                           (asdf:system-relative-pathname :mgl-pax "web/")))
 (uiop:directory*
          (merge-pathnames "*.*"
                           (asdf:system-relative-pathname :mgl-pax "web/")))
(#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/style.css" #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/jquery.min.js" #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xcharter/" #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/toc.min.js" #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/README" #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xeb-garamond/")

CL-USER 53 > (pprint *)
(pprint *)

(#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/style.css"
 #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/jquery.min.js"
 #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xcharter/"
 #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/toc.min.js"
 #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/README"
 #P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xeb-garamond/")

CL-USER 54 > (dolist (x **) (describe x))
(dolist (x **) (describe x))

#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/style.css" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           "style"
TYPE           "css"
VERSION        :UNSPECIFIC
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/jquery.min.js" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           "jquery.min"
TYPE           "js"
VERSION        :UNSPECIFIC
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xcharter/" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           :UNSPECIFIC
TYPE           :UNSPECIFIC
VERSION        :NEWEST
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/toc.min.js" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           "toc.min"
TYPE           "js"
VERSION        :UNSPECIFIC
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/README" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           "README"
TYPE           :UNSPECIFIC
VERSION        :UNSPECIFIC
#P"/sp/lispsrc/misc/qa/shared/quicklisp/quicklisp-home/dists/quicklisp/software/mgl-pax-20230618-git/web/xeb-garamond/" is a PATHNAME
HOST           :UNSPECIFIC
DEVICE         :UNSPECIFIC
DIRECTORY      (:ABSOLUTE "sp" "lispsrc" "misc" "qa" "shared" "quicklisp" "quicklisp-home" "dists" "quicklisp" ...)
NAME           :UNSPECIFIC
TYPE           :UNSPECIFIC
VERSION        :NEWEST
NIL

CL-USER 55 > 
melisgl commented 1 year ago

Committed as f0fd1ab5af0cefed2edd98d5b2288270b2180b0a. Thank you for the report and the fix.

It's likely that there are other issues on Lispworks as I'm not testing on it. It's not supported by roswell, and I had some trouble before (maybe with the heap limit?) getting it to work.