# Latest case-insensitivity proposal

**URL:** https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161
**Category:** Development
**Created:** [June 9, 2020, 1:34pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161 "2020-06-09T13:34:32Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 9, 2020, 1:34pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/1 "2020-06-09T13:34:32Z")

</div>

This is a discussion thread for the issue/proposal outlined in this wiki page: [https://github.com/syncthing/syncthing/wiki/Filesystem-Case-Sensitivity#detect-real-case-proposal](https://github.com/syncthing/syncthing/wiki/Filesystem-Case-Sensitivity#detect-real-case-proposal)

---

<div class="post-metadata">

### Author: ![Moisie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Moisie](https://forum.syncthing.net/u/Moisie)
#### Post date: [June 9, 2020, 2:22pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/2 "2020-06-09T14:22:20Z")

</div>

Hi,

I love that this is getting some love again - all credit to the brains that are working hard to solve this problem.

I don’t have any huge insights to offer - but I just want to make sure that the proposal will also cover case-sensitive renames of folders - e.g. `/a/foo.txt` and `/A/foo.txt`.

So far I’ve only seen discussions of file name conflicts - but folder ones happen too.

Thanks!

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 9, 2020, 4:28pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/3 "2020-06-09T16:28:21Z")

</div>

> [@Moisie](#):
>
> So far I’ve only seen discussions of file name conflicts - but folder ones happen too.

Files and folders (and symlinks for the matter) are all the same when it comes to their name. I try to use “item” when I don’t mean files specifically, but clearly am not consistent 🙂

---

<div class="post-metadata">

### Author: ![nekr0z](https://forum.syncthing.net/user_avatar/forum.syncthing.net/nekr0z/32/4823_2.png) [@nekr0z](https://forum.syncthing.net/u/nekr0z)
#### Post date: [June 9, 2020, 4:38pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/4 "2020-06-09T16:38:36Z")

</div>

Regarding the detection of the underlying filesystem’s case-sensitivity: it will be a mess. At the very least, it will have to be done for _every_ subdirectory, because every subdirectory may turn out to be a mounted filesystem with different case-capabilities.

---

<div class="post-metadata">

### Author: ![Moisie](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Moisie](https://forum.syncthing.net/u/Moisie)
#### Post date: [June 9, 2020, 4:53pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/5 "2020-06-09T16:53:03Z")

</div>

Hi:

Cool - I suspected you might have considered it already… 😉

For months, my poor little lizard brain has been trying to get itself round what happens when you have folder `a` containing `foo1.txt` and `foo2.txt`, and the folder gets renamed to `A`…

In the current workings (if I understand correctly), there’s a chance that these renames might get processed as adds then deletes - but that means you’ll have folders `a` and `A` temporarily trying to reside in the same place…

But I’m sure this is just tiny scratching of the surface of a whole bunch of cases that have to be considered!

Thanks all for giving this some attention. You’ll save me hours of work of trying to undo other peoples’ mess.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [June 9, 2020, 5:29pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/6 "2020-06-09T17:29:43Z")

</div>

Is it that simple though?

If I have

```
Add foo/
Add foo/A
Add foo/B

```

and now, because of batching, I get a partial rename

```
Remove foo/A
Remove foo/
Add Foo/
Add Foo/A

```

what do you do with `foo/B`?

Also, what happens to the directory where B resided? Or do we just rename everything that was under `foo` to `Foo` and rescan somehow? Potentially end up with conflicts of new unexpected B appearing?

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 9, 2020, 7:01pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/7 "2020-06-09T19:01:17Z")

</div>

Already today we wont remove `foo` as `foo/B` still exists - dirs with non-deleted children are a sync error. And then with the new case-awareness, we will also throw errors for (and not create) `Foo` and `Foo/B`. Once the batch removing `foo/B` arrives, everything will resolve.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 9, 2020, 8:41pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/8 "2020-06-09T20:41:37Z")

</div>

> [@nekr0z](#):
>
> detection of the underlying filesystem’s case-sensitivity: it will be a mess

For the record, the current plan is not to attempt to detect whether the filesystem is case sensitive or not. The plan is to correctly detect and handle case-only renames regardless of the case sensitivity of the filesystem, and to detect case conflicts on sync operations. Where a “case conflict” is that we’re going to do something to `A` but instead find an `a` that gets returned when looking for `A` – something that only happens on case insensitive fs:s. This we might do by directory listings or system-specific magic syscalls where available, as appropriate.

---

<div class="post-metadata">

### Author: ![nekr0z](https://forum.syncthing.net/user_avatar/forum.syncthing.net/nekr0z/32/4823_2.png) [@nekr0z](https://forum.syncthing.net/u/nekr0z)
#### Post date: [June 9, 2020, 8:44pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/9 "2020-06-09T20:44:51Z")

</div>

I was referring to section 1 of the “Open Questions” in the linked wiki article. Either I misunderstood it or @imsodin is indeed talking about sensitivity autodetection there.

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 9, 2020, 8:45pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/10 "2020-06-09T20:45:43Z")

</div>

The wiki article lists possible options for what I consider(ed) open questions, and it still does list my proposal of probing the fs to detect case-insensitivity and Audrius’ proposal to extend the FAT detection on android next to your proposal to just always check for case.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 9, 2020, 8:49pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/11 "2020-06-09T20:49:11Z")

</div>

Right, I hadn’t actually fully read it, instead basing stuff on the plan in my head, sorry 😃

I don’t think we should attempt any kind of filesystem detection, for among other things the reasons mentioned by nekr0z. We should simply operate on the assumption that the filesystem is a bastard and be surprised and delighted if it isn’t. I also don’t think we need to fire off a case conflict when dealing with `a` and `A` in the same place. We only do that when we detect (during our usual stat-before-commit check) that the stat for `A` actually returned `a`.

There will be tricky corner cases (particularly merging two Windowses where both have pre-existing data in a new folder that differ just in case). Regardless I think we should try very hard to make it a general solution that can work on Windows, Linux, Windows with case sensitivity enabled, Linux on case-insensitive FS, etc without any user input or “detection” other than what we can tell about the specific file we are working with at the moment.

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 9, 2020, 8:59pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/12 "2020-06-09T20:59:10Z")

</div>

Detecting or not detecting is deep in bikeshedding territory at this point (entirely optional optimisation), nevertheless I can’t hold myself back: An `if _, err := fs.Lstat(strings.ToUpper(fcfg.MarkerName)); fs.IsNotExist(err) { *filesystem is not a bastard* }` doesn’t seem very messy to me 🙂

As to cornercases: I am currently quite confident that the simplest approach (throw sync errors at the user for every case problem) solves all of them. Small disclaimer: Confidence is usually way too high at the beginning of projects.

---

<div class="post-metadata">

### Author: ![nekr0z](https://forum.syncthing.net/user_avatar/forum.syncthing.net/nekr0z/32/4823_2.png) [@nekr0z](https://forum.syncthing.net/u/nekr0z)
#### Post date: [June 9, 2020, 9:04pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/13 "2020-06-09T21:04:09Z")

</div>

We’re not creating a marker in every subdirectory now, are we?

But I agree, let’s try to implement that universal listdir-based method first, otherwise it’s all moot.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 9, 2020, 9:04pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/14 "2020-06-09T21:04:56Z")

</div>

Problem is a folder might consist of any number of different file systems mounted in various places. Conditions at the folder root may not be representative of any other directory.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [June 10, 2020, 7:21am UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/15 "2020-06-10T07:21:48Z")

</div>

Sure, yet I think we should auto-detect but allow users to toggle, for cases like that.

---

<div class="post-metadata">

### Author: ![asteppke](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/a/da6949/32.png) [@asteppke](https://forum.syncthing.net/u/asteppke)
#### Post date: [June 11, 2020, 9:39am UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/16 "2020-06-11T09:39:01Z")

</div>

Great that this issue moves forward!

In the current proposal there were two possibilities mentioned upon failure: halt/error or create a conflict. As someone who has been hit by this before when a user renamed “documents” to “Documents” a sync error seems much saner than creating a conflicted (duplicated?) directory tree, an operation that can easily fail with large directories.

> Sure, yet I think we should auto-detect but allow users to toggle, for cases like that.

Absolutely yes please! This is clearly a case where auto-detection would get it right in 99% of cases and the advanced users like nekr0z that dare to mount filesystems with different case-sensitivity under the same folder should change the defaults to their liking.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 12, 2020, 9:37am UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/17 "2020-06-12T09:37:57Z")

</div>

The idea is that the mechanism shouldn’t need auto detection or configuration, because the same behavior (from Syncthing’s side) should result in correct results on both sensitive and insensitive file systems. The reason to have a configuration anyway is that the new, safer, behavior would result in more file system operations. Having a switch to say “there is no need to be safe, I promise everything is case sensitive everywhere” might be useful in some scenarios. _Might._

---

<div class="post-metadata">

### Author: ![cosas](https://forum.syncthing.net/user_avatar/forum.syncthing.net/cosas/32/14159_2.png) [@cosas](https://forum.syncthing.net/u/cosas)
#### Post date: [June 14, 2020, 9:20am UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/18 "2020-06-14T09:20:56Z")

</div>

My 1.5 cents, please be lenient as I’m not aware of all difficulties you devs have to face with this issue:

When a case sensitive device case-only-renames an item (let say `item` to `Item`) I figure the receiving case insensitive device detects this as is and could deal it a special way, e.g. creating an hidden temporary item called something like `.syncthing-caseSensitivity-Item`, let it sync, delete `item` but does not update DB, and only then move `.syncthing-caseSensitivity-Item` to `Item` and terminates the process the same way as usual.

Sorry if you already thought it this way.

---

<div class="post-metadata">

### Author: ![mdell-seradex](https://forum.syncthing.net/user_avatar/forum.syncthing.net/mdell-seradex/32/10202_2.png) [@mdell-seradex](https://forum.syncthing.net/u/mdell-seradex)
#### Post date: [June 3, 2021, 9:17pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/19 "2021-06-03T21:17:55Z")

</div>

I know this is a little old now, but I am not sure I understand what the final solution was. I am hoping that someone can update this with what it does or provide a link to that information.  
I read somewhere that essentially says syncthing now simulates a case sensitive file system when interacting with case insensitive ones, but that is a simple explanation and sounds like the opposite of the desired behaviour.  
Note that NTFS partitions can be created in Linux as well, which Linux treats as case insensitive. In addition, Windows now has the ability to mark a specific NTFS folder as case sensitive, but this does not apply to its subfolders.

I look forward to reading the response. Thank you.

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [June 3, 2021, 9:24pm UTC](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161/20 "2021-06-03T21:24:55Z")

</div>

This should answer your question: [Understanding Synchronization — Syncthing v1 documentation](https://docs.syncthing.net/users/syncing.html#case-sensitivity)  
tl;dr: You shouldn’t need to care about case sensitivity anymore - if there’s problems/clashes, there will be an error telling you about it.

[Next page](https://forum.syncthing.net/t/latest-case-insensitivity-proposal/15161.md?page=2)
