Common Lisp Longstanding Path Wildcard Bug Fix In Zip Package
published: [nandalism home] (dark light)
Common Lisp Longstanding Path Wildcard Bug Fix In Zip Package
Getting the error "bad place for a wild pathname" when unzip'ing paths with anything SBCL considers a wildcard [,],*,? (maybe others).
This quick hack to the quicklisp zip package got me past unzip, there may be other problems.
$ vi ~/quicklisp/dists/quicklisp/software/zip-20150608-git/zip.lisp ;; ME @date 2023-08-17 16:53:02Z (wildcards in path []*?) (defun escape-path-wildcards (p) (setf p (format nil "~a" p)) (setf p (cl-ppcre:regex-replace-all "\\[" p "\\[")) (setf p (cl-ppcre:regex-replace-all "\\]" p "\\]")) (setf p (cl-ppcre:regex-replace-all "\\?" p "\\?")) (setf p (cl-ppcre:regex-replace-all "\\*" p "\\*"))) (defun unzip ... (let* (#+nil (name (ppcre:regex-replace-all "[/*?]" name "_")) #+nil (name (subseq name 0 (min (length name) 128))) (filename (merge-pathnames name target-directory))) (setf filename (escape-path-wildcards filename)) ;; <------- THIS!!! (ensure-directories-exist filename)Add the cl-ppcre dependency.
$ vi ~/quicklisp/dists/quicklisp/software/zip-20150608-git/zip.asd :depends-on (#:cl-ppcre :salza2 :trivial-gray-streams :babel :cl-fad)
zip - do not store directory entries, only files
The zip package #'zip function has an undocumented skip-directories-p
flag to avoid writing directory entries in the zip file.