Win32: DIRECTORY case sensitive

Bug #550393 reported by Chisheng Huang on 2010-03-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

MS Windows uses case insensitive file names. PROBE-FILE and DELETE-FILE in
SBCL Win32 are case insensitive, as we expect; but, DIRECTORY is case
sensitive sometimes. The following example demonstrates the problem.

Directory d:/test/ has 2 files: AA.C01 and AA.PNG

(directory #P"d:/test/AA.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
(directory #P"d:/test/aa.*") => NIL

(directory #P"d:/test/A*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
(directory #P"d:/test/a*.*") => NIL

For SBCL Win32, substituting EQUALP for the only EQUAL in MAKE-MATCHER
in sbcl/src/code/filesys.lisp and STRING-EQUAL for the only STRING= in
PATTERN-MATCHES in sbcl/src/code/target-pathname.lisp will make DIRECTORY
case insensitive:
(directory #P"d:/test/aa.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
(directory #P"d:/test/a*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")

This is SBCL 1.0.33.4 for Win32.

Output from name -a:
MINGW32_NT-5.1 SQUID 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown

*FEATURES*:
(:ASDF :ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS
 :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS :IEEE-FLOATING-POINT :X86 :WIN32
 :GENCGC :STACK-GROWS-DOWNWARD-NOT-UPWARD :C-STACK-IS-CONTROL-STACK
 :COMPARE-AND-SWAP-VOPS :UNWIND-TO-FRAME-AND-CALL-VOP :RAW-INSTANCE-INIT-VOPS
 :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-VECTORS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-FIXED-OBJECTS :ALIEN-CALLBACKS
 :CYCLE-COUNTER :INLINE-CONSTANTS :LINKAGE-TABLE :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-PUTWC)

Thanks.

-cph

Nikodemus Siivola (nikodemus) wrote :

Unless I'm terribly mistaken NTFS volumes are case-sensitive even on Windows. So unless DIRECTORY on Windows has a separate keyword to control case-sensitivity, the default will by necessity be sometimes wrong?

What do Lispworks and Allegro do?

tags: added: os-windows
Changed in sbcl:
importance: Undecided → Medium
status: New → Triaged
Nikodemus Siivola (nikodemus) wrote :

Ouch, ouch, ouch.

The thing is, by using the WinAPI function FindFirstFile the right things should happen pretty much by itself.

...but this means rewriting DIRECTORY, pretty much. Again. :/

Nikodemus Siivola <email address hidden> writes:

> Unless I'm terribly mistaken NTFS volumes are case-sensitive even on
> Windows. So unless DIRECTORY on Windows has a separate keyword to
> control case-sensitivity, the default will by necessity be sometimes
> wrong?
>
> What do Lispworks and Allegro do?

No idea about Allegro. With Lispworks 4.3.7 for Windows and a
directory d:/test/ with 2 files: AA.C01 and AA.PNG,

(directory #p"d:/test/AA.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
(directory #p"d:/test/aa.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")

(directory #p"d:/test/A*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
(directory #p"d:/test/*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")

So, Lispworks 4.3.7 for Windows has case-insensitive DIRECTORY.

Thanks a lot for looking into this.

Best wishes,

-cph

Chisheng Huang <email address hidden> writes:

> Nikodemus Siivola <email address hidden> writes:
>
>> Unless I'm terribly mistaken NTFS volumes are case-sensitive even on
>> Windows. So unless DIRECTORY on Windows has a separate keyword to
>> control case-sensitivity, the default will by necessity be sometimes
>> wrong?
>>
>> What do Lispworks and Allegro do?
>
> No idea about Allegro. With Lispworks 4.3.7 for Windows and a
> directory d:/test/ with 2 files: AA.C01 and AA.PNG,
>
> (directory #p"d:/test/AA.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
> (directory #p"d:/test/aa.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
>
>
> (directory #p"d:/test/A*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
> (directory #p"d:/test/*.*") => (#P"d:\\test\\AA.C01" #P"d:\\test\\AA.PNG")
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        ^
This should be: (directory #p"d:/test/a*.*")

-cph

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers