Case Sensitive File Names


jochen

Recommended Posts

I have the following situation: My music is stored on a NAS (WD MyCloud) and distributed to all my pc through bittorrent sync. All pc are running Linux. A Raspberry PI is running btsync and has the NAS mounted through Samba.

At a certain stage, when ripping music, it happens that I have 3 different folders which leead to the same folder in case insensitive windows naming. Example: "Cirque du soleil", "Cirque du Soleil" and "Cirque Du Soleil". After ripping I will move the album subfolders to the right main folder and delete the other 2.

What happens to the Samba mounted NAS on the Pi? Can btsync handle this situation?

Link to post
Share on other sites

Good point, but what happens next when Windows machines are involved?

 

1) Linux

FILE

file

 

2) another Linux receives

FILE.conflict

file.conflict

 

3) a Windows machine then receives?

FILE.conflict

file.conflict that overwrites FILE.conflict???

 

4) sync back to Linux:

file.conflict

delete FILE.conflict?

Link to post
Share on other sites

Windows: actually NTFS is a case preserving file system and could have two or more files with the same name in the same folder just like most Unix file systems do (there's a specific flag to set,  OBJ_CASE_INSENSITIVE, when calling NtCreateFile API, to enable POSIX semantics), but Explorer could then not handle them correctly.

Link to post
Share on other sites

Perhaps BT developers should just add a configuration option for Win64 builds, for the "adventurous ones" or those who need exact replication and have peers which are case preserving AND case sensitive.

 

@RomanZ

It is not a matter of liking or not liking: since the protocol is intended to mirror, it is an incomplete protocol if each peer namespace capability is not propagated to the others, either to disable replication (because a node can't implement the exact namespace semantics of other peers in the replica set), or to ask user what to do/notify there are issues (to avoid overwriting files in case a peer is case sensitive and it is only case preserving: I know you create *.conflict, but that's inelegant and turns a replica into a mess for noobs).

Link to post
Share on other sites

@eazq

Well, Sync IS case sensitive while Windows filesystems are not. Current solution is not the most elegant indeed - we are aware of it and eventually will implement a better solution.

 

Just in case, one day, your team will improve the btsync's name management code, here is a note about file systems under NT operating system family (modern Windows variants are descendants of NT). Whole namespace is managed by a kernel mode subsystem called "Ob" (Object Manager). Since XP/2003, Ob can run in two distinct modes:

  • case preserving mode (default)
  • case sensitive mode (former default mode, useful mostly when you install the POSIX environment subsystem, called by marketing people Interix, SFU, SUA and historically inherited from its ancestor kernel at DEC).

Before XP, NT's object manager used to always run in case sensitive mode and only Win32 environment subsystem used to issue system calls with case insensitive flag set.

 

Please, open regedit and select this key

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive

 

That is a REG_DWORD value which can be 1 for running the kernel in case-preserving mode and 0 for running the kernel in case-sensitive mode. Since you must set a positive value to enable a negative behaviour ("in-sensitive") you may guess that it is a later addition to the registry: in fact it was added after NT 5.0 (Windows 2000).

 

Just make btsync query that key, or give advanced users an advanced option to retain actual names sent from case sensitive btsync peers.

Link to post
Share on other sites

Not for 32 bit applications: http://support.microsoft.com/kb/100625/

 

Unless your Win32/Win64 application explicitly issues system calls WITHOUT the case insensitive flag set. Microsoft's own stock applications and default applications written for Windows actually don't support name case sensitivity, simply because at Microsoft they decided they shouldn't be aware of name case (for usability or compatibility?), not because Windows kernel can't handle them correctly. Similarly in Mac OS, where your choice is more granular, because you can set at formatting time if a volume is to be case-preserving or case-sensitive.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.