Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improper handling of pathname-name for dotfiles #521

Open
kingcons opened this issue Oct 8, 2024 · 4 comments
Open

Improper handling of pathname-name for dotfiles #521

kingcons opened this issue Oct 8, 2024 · 4 comments

Comments

@kingcons
Copy link

kingcons commented Oct 8, 2024

A test case is as follows:

(defvar *example* #p"/home/cons/projects/collards/examples/.collards")
(pathname-name *example*) ;; returns NIL
(pathname-type *example*) ;; returns "collards"

This causes an incorrect result from uiop:hidden-pathname-p. (see: https://gitlab.common-lisp.net/asdf/asdf/-/blob/master/uiop/pathname.lisp#L257)

I don't claim that this is in violation of the standard, but it seems to be the opposite interpretation to all three other implementations I tested: clisp, ecl, and sbcl.

@kingcons kingcons changed the title Improper handling of pathname-name for dotfiles? Improper handling of pathname-name for dotfiles Oct 8, 2024
@phoe
Copy link
Contributor

phoe commented Oct 8, 2024

If anything,

CL-USER> (make-pathname :directory '(:absolute "foo" "bar") :name ".baz")
#P"/foo/bar/\\.baz"

So the issue is in how CCL parses and prints unix-like namestrings differently than other implementations (note the extra slash in the namestring; IIUC it is there to show that the dot is a part of the name, not the type) and not in how an already cooked pathname works with regards to uiop:hidden-pathname-p.

Maybe the TODO at

;; TODO: -->> Need to make an exception so that ".emacs" is name with no type.
is a hint towards this?

@xrme
Copy link
Member

xrme commented Oct 15, 2024

I sincerely don't know what the right thing is.

An older LispWorks I have installed says

(pathname-name *example*) ;; returns ""
(pathname-type *example*) ;; returns "collards"

The comment by @phoe shows an instance of CCL's namestring quoting. To be honest, I've been wondering for a long time whether CCL should stop doing this. See #42.

@phoe
Copy link
Contributor

phoe commented Oct 15, 2024

On the other hand, LW 8.0.1 Personal says:

CL-USER 1 > (describe (make-pathname :directory '(:absolute "foo" "bar") :name ".baz"))

#P"/foo/bar/.baz" is a PATHNAME
HOST           NIL
DEVICE         NIL
DIRECTORY      (:ABSOLUTE "foo" "bar")
NAME           ".baz"
TYPE           NIL
VERSION        NIL

CL-USER 2 > (describe (make-pathname :directory '(:absolute "foo" "bar") :type "baz"))

#P"/foo/bar/.baz" is a PATHNAME
HOST           NIL
DEVICE         NIL
DIRECTORY      (:ABSOLUTE "foo" "bar")
NAME           NIL
TYPE           "baz"
VERSION        NIL

Notice the ambiguous namestring.

@informatimago
Copy link

informatimago commented Oct 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants