Opened 12 years ago

Closed 12 years ago

#648 closed defect (fixed)

Clozure on windows can't handle files with names containing single quotes

Reported by: eeeickythump Owned by: gb
Priority: normal Milestone:
Component: ANSI CL Compliance Version: 1.4
Keywords: pathname windows Cc:


I am reposting this message from Lispforum, because the problem appears to be specific to Clozure CL.

I have a problem with a program I have written that parses files for the game "Morrowind".

If interested the repository is at

Basically the problem is with filenames that have a single quote in them. Clozure's pathname functions seem to insist on mangling these filenames by removing the quote (which is a perfectly legal character in Windows filesystems).

Using Clozure CL 1.4 on WinXP:

CL-USER> (probe-file "c:/Morrowind/Data Files/Beryl's_Head_Replacer_v1.0.esm")  ; this is the actual filename
CL-USER> (probe-file #p"c:/Morrowind/Data Files/Beryl's_Head_Replacer_v1.0.esm")
CL-USER> (pathname "c:/Morrowind/Data Files/Beryl's_Head_Replacer_v1.0.esm")
#P"c:/Morrowind/Data Files/Beryls_Head_Replacer_v1'.0.esm"    ; note the mangling of single quotes
CL-USER> (probe-file *)
CL-USER> (pathname "c:/Morrowind/Data Files/Beryl\'s_Head_Replacer_v1.0.esm")
#P"c:/Morrowind/Data Files/Beryls_Head_Replacer_v1'.0.esm"
CL-USER> (pathname "c:/Morrowind/Data Files/Beryl\\'s_Head_Replacer_v1.0.esm")
#P"c:/Morrowind/Data Files/Beryl/s_Head_Replacer_v1'.0.esm"
CL-USER> (pathname "c:/Morrowind/Data Files/Beryl''s_Head_Replacer_v1.0.esm")   ; try 2 quotes
#P"c:/Morrowind/Data Files/Beryl''s_Head_Replacer_v1'.0.esm"    ; this fails too

I've had to release a version of the program that asks the users to rename any files with apostrophes in their names. This is rather embarrassing for someone who is trying to advocate common lisp as the best programming language around!

Can someone enlighten me as to how I can get clozure to recognise these filenames?

Change History (3)

comment:1 follow-up: Changed 12 years ago by gb

At least in the short term, you can probably work around this by doing something like:

? (setq ccl::*pathname-escape-character* #\^Q)

(That's typed as "sharp, backslash, circumflex, q"; it's a way of referring to "ctrl-q", aka (code-char 16).)

That particular character is intended to be:

  • possible, if a little awkward, to type
  • usually echoed in some way
  • either explicitly illegal or extremely unlikely to be used in a valid filename.

(The same was supposed to be true of #\' on Windows as well, but apparently isn't ...)

The whole concept of quoting or escaping characters in pathname components may be flawed, and the implementation certainly is. Changing the character used to do that quoting/escaping from #\' to ... something like ^Q causes #\' to be treated as an ordinary constituent character, which is what you want here.

comment:2 in reply to: ↑ 1 Changed 12 years ago by eeeickythump

Replying to gb:

At least in the short term, you can probably work around this by doing something like:

? (setq ccl::*pathname-escape-character* #\^Q)

Thanks, that works!

comment:3 Changed 12 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

r13568 changes the default *pathname-escape-character* to #\> on Windows systems. #\> is not a legal filename constituent on Windows; see the commit log message.

This change is in the trunk and will be in future releases.

Note: See TracTickets for help on using tickets.