Skip to content
Snippets Groups Projects
Commit ad045f27 authored by rtoy's avatar rtoy
Browse files

code/filesys.lisp:

o Make the #p reader treat ".." as a directory, not a file.
o Make the #p reader treat "<lots of dots>" be a file with that name
  instead of name with one fewer dot and type "".  So #p"..." has
  :name "...", :type nil instead of :name "..", :type "".

code/pathname.lisp:
o Issue a warning if someone wants :name to be ".." or ".".  We allow
  it, but doing so will break print/read consistency.  (Should we make
  such pathnames not readably printable?)
parent 89a2736d
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.89 2005/09/12 14:38:17 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/filesys.lisp,v 1.90 2005/09/21 20:01:34 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -301,14 +301,25 @@ ...@@ -301,14 +301,25 @@
(setf absolute t) (setf absolute t)
(setf (car first) new-start)) (setf (car first) new-start))
search-list))))) search-list)))))
(multiple-value-bind (multiple-value-bind (name type version)
(name type version)
(let* ((tail (car (last pieces))) (let* ((tail (car (last pieces)))
(tail-start (car tail)) (tail-start (car tail))
(tail-end (cdr tail))) (tail-end (cdr tail)))
(unless (= tail-start tail-end) (unless (= tail-start tail-end)
(setf pieces (butlast pieces)) (setf pieces (butlast pieces))
(extract-name-type-and-version namestr tail-start tail-end))) (cond ((string= namestr ".." :start1 tail-start :end1 tail-end)
;; ".." is a directory. Add this piece to the
;; list of pieces, and make the name/type/version
;; nil.
(setf pieces (append pieces (list (cons tail-start tail-end))))
(values nil nil nil))
((not (find-if-not #'(lambda (c)
(char= c #\.))
namestr :start tail-start :end tail-end))
;; Got a bunch of dots. Make it a file of the same name, and type nil.
(values (subseq namestr tail-start tail-end) nil nil))
(t
(extract-name-type-and-version namestr tail-start tail-end)))))
;; PVE: Make sure there are no illegal characters in the name ;; PVE: Make sure there are no illegal characters in the name
;; such as #\Null and #\/. ;; such as #\Null and #\/.
(when (and (stringp name) (when (and (stringp name)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pathname.lisp,v 1.77 2005/09/19 21:04:43 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/pathname.lisp,v 1.78 2005/09/21 20:01:34 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -733,7 +733,10 @@ a host-structure or string." ...@@ -733,7 +733,10 @@ a host-structure or string."
(check-component-validity type :pathname-type) (check-component-validity type :pathname-type)
(mapc #'(lambda (d) (mapc #'(lambda (d)
(check-component-validity d :directory)) (check-component-validity d :directory))
(cdr dir))) (cdr dir))
(when (and (stringp name)
(or (string= name "..") (string= name ".")))
(warn "Silly argument for a unix PATHNAME-NAME: ~S" name)))
;; More sanity checking ;; More sanity checking
(when dir (when dir
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment