handle NTFS case-sensitivity

Features wanted...
Post Reply
bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

handle NTFS case-sensitivity

Post by bdeshi »

NTFS allows case-sensitivity in filenames, But Windows API normalizes all read/writes. I wish XYplorer could handle this, where appropriate.


I inadvertently created something like this (on <xydata>) while running my linux os, but then in XYplorer on windows, could access only one of the items, effectively making contents of the other non-existent to XY (and the system).
case-insense.png
case-insense.png (5.36 KiB) Viewed 1012 times
Doing "research" on how this may be done. Meanwhile, how does XY read paths in tagdb case-sensitively? Maybe those apis can be used here?


It's fine if you put it way down on the todo list. :)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: handle NTFS case-sensitivity

Post by admin »

AFAIK there are one or two APIs that support a flag to honor NTFS case-sensitivity.

But, how can I create such a test situation on Windows (not having Linux). Does Zip/Unzip work (i.e. could you send me a package)?

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: handle NTFS case-sensitivity

Post by bdeshi »

admin wrote:how can I create such a test situation on Windows (not having Linux). Does Zip/Unzip work (i.e. could you send me a package)?
I've created a tar archive, but Windows or common utils like 7zip can't extract it properly. Utils in cygwin work though. I'll try sending a minimal isolated cygwin testing environment.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: handle NTFS case-sensitivity

Post by admin »

Don't get too involved. I think this is madness and it's very unlikely that I will support it.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: handle NTFS case-sensitivity

Post by bdeshi »

admin wrote:... (i.e. could you send me a package)?
Okay, i've made a bare minimal cygwin environment+wrappers. (portable by itself, but you have to do a registry tweak to work with case-sensitive paths.)
https://drive.google.com/file/d/0B4sPBJ ... sp=sharing
run caseTest.bat in an admin cmd prompt. It will prompt for applying the registry tweak. Restart and run the bat again. Now you should be in a bash prompt [*], opened to ~ (home) which is set to the \home folder.
The tar archive is in home, which you can extract with:

Code: Select all

tar -xf ~/caseTest.tar
This extracts to ~/caseTest/. Which should match caseTest-content.txt. List contents:

Code: Select all

tree ~/caseTest
View the files are indeed different:

Code: Select all

cat ~/caseTest/test_ABC.txt
cat ~/caseTest/test_abc.txt
You can create files for testing yourself with touch (and mkdir):

Code: Select all

touch CasedFile.txt CASEDFILE.txt
[*] If you'd rather not live in a bash shell, just go into /bin/ and run them from a regular commandprompt. (except mkdir/rmdir, it will be overridden by builtin cmd. Rename it to _mkdir/rmdir.) But in this method, $HOME is reset to %USERPROFILE%.
admin wrote:Don't get too involved. I think this is madness and it's very unlikely that I will support it.
Either way, as a result I've constructed a pretty nifty toolset to handle case-sensitive files on Windows.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: handle NTFS case-sensitivity

Post by admin »

Thanks (though I won't have the time to test it now).

In the meantime I tried to create files that only differ in case according to MS Windows API documentation (CreateFile with FILE_FLAG_POSIX_SEMANTICS) but for unknown reasons it failed. Eventually I had to give up. If even this does not work I see not the slightest chance to support this. :|

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: handle NTFS case-sensitivity

Post by bdeshi »

admin wrote:In the meantime I tried to create files that only differ in case according to MS Windows API documentation (CreateFile with FILE_FLAG_POSIX_SEMANTICS) but for unknown reasons it failed. Eventually I had to give up.
Eh? I'd tried the same thing, and I can create case-differing files! Have you set this to 0?

Code: Select all

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
case-sense-creation.gif
case-sense-creation.gif (190.07 KiB) Viewed 927 times
[/size]
my code snippet, in freebasic, if it helps

Code: Select all

#include "windows.bi"
/' CreateFile( https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx [def.] '/

Dim As HANDLE  hFile                 ' handle to created/opened file
Dim As String  FileName = Command(1) ' ptr to target filename
hFile = CreateFile(                                _
                    FileName,                      _ ' name of the file
                    GENERIC_READ Or GENERIC_WRITE, _ ' open for reading
                    FILE_SHARE_READ,               _ ' share readable access
                    NULL,                          _ ' default security
                    OPEN_ALWAYS,                   _ ' open file or create if doesnt exist
                    FILE_ATTRIBUTE_NORMAL Or FILE_FLAG_POSIX_SEMANTICS,_ ' allow case-sensitivity
                    NULL                          _ ' no attr. template
                )
/' [print output]
[/size]
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: handle NTFS case-sensitivity

Post by bdeshi »

btw,
admin wrote:In the meantime I tried to create files that only differ in case
I should clarify, the wish is to properly manage case-sensitive items already on the filesystem, not create new ones.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: handle NTFS case-sensitivity

Post by admin »

OK, I had overlooked the obcaseinsensitive flag part. Now I can create them.

But I don't see how to manage them. Only CreateFile and FindFirstFileEx support case-sensitive operations, that's not enough for file management. :|

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: handle NTFS case-sensitivity

Post by bdeshi »

I can make do with a quick switch to my Xubuntu OS, or cygwin's (cp|mv|rm|rmdir|mkdir|touch|ls) - perhaps with a xyscript caller. (Wonder how these tools work... maybe some very low-level api calls?)
Still I'll appreciate it if you put a note on your desk somewhere in a corner. I don't think there are many FMs on Windows that can claim this particular feature.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: handle NTFS case-sensitivity

Post by admin »

This funny folder is my note:
Attachments
posix.png
posix.png (6.85 KiB) Viewed 857 times

Post Reply