Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be more kind with non-normalized UTF-8 filenames #9483

Closed
stkw0 opened this issue Mar 25, 2024 · 7 comments
Closed

Be more kind with non-normalized UTF-8 filenames #9483

stkw0 opened this issue Mar 25, 2024 · 7 comments
Labels
enhancement New features or improvements of some kind, as opposed to a problem (bug) needs-triage New issues needed to be validated

Comments

@stkw0
Copy link

stkw0 commented Mar 25, 2024

Feature description

Currently, syncthing tries to normalize the UTF-8 filenames before syncthing, but that can be problematic in some use cases. I would like that syncthing could work and sync files even in the event of non normalized filenames (at least for the source part, the destination could be normalized if required).

Problem or use case

In my setup I use syncthing to sync a Music folder between my personal computer and a different computer. The Music files of that Music folder are music coming from torrent sites that I would like to keep seeding. In order to seed those torrents the filenames should not change as otherwise the torrent client will detect it as corrupt files as it would not match the original filenames. If I use syncthing with default settings, it would normalize the filenames, thus causing problems to the torrent client. But if they are not normalized syncthing would not sync the files

Alternatives or workarounds

As I don't have much control over the source files I can not see any alternative. The only workaround would be to have two copies of the files, one for the torrents and another for syncthing, but that would not work as I wouldn't have enough disk space to hold two copies of the entire library.

@stkw0 stkw0 added enhancement New features or improvements of some kind, as opposed to a problem (bug) needs-triage New issues needed to be validated labels Mar 25, 2024
@calmh
Copy link
Member

calmh commented Mar 25, 2024

Yeah I don't know what we'd do better here. You can of course disable normalisation, but the problem with running without it is that Syncthing could sync a file from another device that has the same name but just differs in normalisation, which is both confusing on disk and also something we don't support since file names over the wire are normalised... i.e., there is literally no way to express a non-normalised filename in the wire protocol.

@stkw0
Copy link
Author

stkw0 commented Mar 25, 2024

Wouldn't it be possible to normalize it in the destination machine and not the source one? or keep a map (on ~/.cache let's say) with the non-normalized and normalized filename. The only problematic thing is to rename the file. If the normalized information can be stored in a different place it would be fixed, at least for my use case

@calmh
Copy link
Member

calmh commented Mar 25, 2024

Syncthing is bidirectional; we'd have to know that an incoming notification about a (normalised) filename somehow applies to a different non-normalised name on disk. Separate cache files and stuff is not a thing we do, for a variety of reasons (complexity and race conditions among them).

@stkw0
Copy link
Author

stkw0 commented Mar 25, 2024

Yes, if there are not enough use cases I understand it could be too complex to modify the core just for this. Thinking about a different solution. Would it work to have an option to create a symlink (maybe a hard symlink?¿) with the normalized name that points to the non-normalized name (instead of just renaming)?

@calmh
Copy link
Member

calmh commented Mar 25, 2024

A hard link should work, possibly, if you disable the auto normalisation.

@stkw0
Copy link
Author

stkw0 commented Mar 25, 2024

I see. If syncthing could have two option to handle non-normalized filenames and in case of hardlinks could ignore the non-normalized filename if there exist also a normalized version it would be neat. Never tried to dig into the source code. I guess that it being a very special use case it would be of very low priority, but at some point I could try to open a PR if that's okay.

@calmh
Copy link
Member

calmh commented Mar 25, 2024

I think disabling auto normalisation should give you that behavior. If it does not, I think it's way too detailed and niche a knob for us to have and maintain, honestly. I hope this solves your issue!

@calmh calmh closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or improvements of some kind, as opposed to a problem (bug) needs-triage New issues needed to be validated
Projects
None yet
Development

No branches or pull requests

2 participants