[Git][cmucl/cmucl][master] 2 commits: Fix #135: (unix-namestring ".") should be "./"
Raymond Toy pushed to branch master at cmucl / cmucl Commits: 0a51daf2 by Raymond Toy at 2025-01-01T04:58:21+00:00 Fix #135: (unix-namestring ".") should be "./" - - - - - fbe6f2d6 by Raymond Toy at 2025-01-01T04:58:21+00:00 Merge branch 'issue-135-unix-namestring-dot' into 'master' Fix #135: (unix-namestring ".") should be "./" Closes #135 See merge request cmucl/cmucl!94 - - - - - 2 changed files: - src/code/filesys.lisp - tests/issues.lisp Changes: ===================================== src/code/filesys.lisp ===================================== @@ -721,7 +721,7 @@ verify-existence follow-links nil function)) (:relative - (%enumerate-directories "" (cdr directory) pathname + (%enumerate-directories "./" (cdr directory) pathname verify-existence follow-links nil function))) (%enumerate-files "" pathname verify-existence function)))) @@ -1110,11 +1110,6 @@ optionally keeping some of the most recent old versions." :pathname file :format-control (intl:gettext "~S doesn't exist.") :format-arguments (list file))) - ;; unix-namestring converts "." to "". Convert it back to - ;; "." so we can stat the current directory. (Perhaps - ;; that's a bug in unix-namestring?) - (when (zerop (length name)) - (setf name ".")) (let (author) (unwind-protect (progn ===================================== tests/issues.lisp ===================================== @@ -707,6 +707,33 @@ ".txt") *test-path*)))) +(define-test issue.135 + (:tag :issues) + (assert-equalp "./" (ext:unix-namestring ".")) + (unwind-protect + (progn + ;; Create a test file in the current directory. + ;; unix-namestring requires files to exist to be able to + ;; return the namestring. + (with-open-file (f1 "foo.txt" + :direction :output + :if-exists :supersede) + (print "foo" f1)) + ;; Check unix-namestring and verify that converting the + ;; namestring to a pathname results in the same pathname + ;; object as expected. + (let ((foo (ext:unix-namestring "foo.txt"))) + (assert-equalp "foo.txt" foo) + (assert-equalp (make-pathname :name "foo" :type "txt") + (pathname foo))) + (let ((bar (ext:unix-namestring "src/code/filesys.lisp"))) + (assert-equalp "./src/code/filesys.lisp" bar) + (assert-equalp (make-pathname :directory '(:relative "src" "code") + :name "filesys" + :type "lisp") + (pathname bar)))) + (assert-true (delete-file "foo.txt")))) + (define-test issue.139-default-external-format (:tag :issues) (assert-eq :utf-8 stream:*default-external-format*) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/5d83f1356e1072ab08e6424... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/5d83f1356e1072ab08e6424... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)