Ah, I see.
OK, now I think I understand the rclone sync
code a bit better. rclone sync
matches overwrites with normalized unicode. It does however not transform the copied name. Thus I get 4mvk0n0mss2apim05t4a72hbc4
Then, rclone mount
does not show the NFD version in the mount and I can copy the file into the folder again with Finder. The mount
converts NFD->NFC and I get 5bqaptil47irc1lcspojffi2gk
.
Yes, that makes a lot of sense @kapitainsky . Thank you.
In that case I do agree with you that if mount
handled normalization instead of a mapping in FUSE, the two versions of the file should not be allowed to coexist.
I think it would be much better if rclone always saves normalised names (NFC) in remotes. It saves number of characters (NFD is potentially longer) and creates consistency.
1 Like
on macOS files end up with NFD as this is what macOS is using internally - but you can create NFD name on Linux too - it just have to be deliberate - when on macOS it always happens.
But this would only fix things moving forward - still might be worth. To make all working including past repos we have to think how to do this job in FUSE-T
Since rclone copy/sync
normalizes before comparing source and destination, thus preventing both versions to exist at the same time, it seems like we don't want both versions to coexist.
Might it not make sense for mount
to do the same as well, regardless of which one is presented in Finder / FUSE?
Or perhaps that's exactly what you're suggesting? Thanks
I think we have to assume that NFC and NFD names are all over remotes people use.
We know that it does not bother Linux and Windows - at least as I am aware.
It breaks macOS mount (and yes it is partially due to Apple decision how to handle normalisation - but we wont change it neither).
Now mount is provided by FUSE-T. It does not read names from remote. It uses what rclone serves.
remote -> rclone -> fuse-t -> mount
So could it work if rclone serves to FUSE-T only NFC? Effectively doing NFD->NFC when encountered.Thoughts?
Am I understanding the suggested mapping correctly?
Old:
REMOTE -> MOUNT
NFC -> RCLONE -> NFC -> FUSE -> NFD
NFD -> RCLONE -> NFD -> FUSE -> [nothing]
MOUNT -> REMOTE
NFC -> FUSE -> NFC -> RCLONE -> NFC
NFD -> FUSE -> NFC -> RCLONE -> NFC
New:
REMOTE -> MOUNT
NFC -> RCLONE -> NFC -> FUSE -> NFD
NFD -> RCLONE -> NFC -> FUSE -> NFD
MOUNT -> REMOTE
NFC -> FUSE -> NFC -> RCLONE -> NFC
NFD -> FUSE -> NFC -> RCLONE -> NFC
That makes a lot of sense to me. There is now symmetry on both directions of conversions.
Only issue I can see right now is if NFC and NFD both exist in the remote. You'll have a collision in rclone now instead of in FUSE.
Sorry, another issue I can see is if NFD existed in the remote and you're copying the normalized NFC over it. You'd need to ensure comparison for existing files was also normalized, exactly like rclone copy/sync
already does.
How I see it... but it is still sketchy
Old:
REMOTE -> MOUNT
NFC -> RCLONE -> ??? -> FUSE -> NFC
NFD -> RCLONE -> ??? -> FUSE -> NFD
MOUNT -> REMOTE
NFC -> FUSE -> ??? -> RCLONE -> NFC
NFD -> FUSE -> ??? -> RCLONE -> NFD
New:
REMOTE -> MOUNT
NFC -> RCLONE -> NFC -> FUSE -> NFC
NFD -> RCLONE -> NFC -> FUSE -> NFC
MOUNT -> REMOTE
NFC -> FUSE -> ??? -> RCLONE -> NFC
NFD -> FUSE -> ??? -> RCLONE -> NFC
clearly you can see I am still missing some bits:) We will get there.
The issue has been swept under the carpet for very long. Time to get it right.
1 Like
signal9:
Sorry, another issue I can see is if NFD existed in the remote and you're copying the normalized NFC over it. You'd need to ensure comparison for existing files was also normalized, exactly like rclone copy/sync
already does.
Yes it is can of worms. Agree
1 Like
This is what others do:
https://docs.syncthing.net/advanced/folder-autonormalize.html
And example of Apple advice how to "fix" similar issues - in this case NFS/SMB
https://openradar.appspot.com/FB8957502
when he talks POSIX I think shell (at the end macOS is proper UNIX) and NSURL is GUI API so Finder - hence we have this weird behaviour that shell works sometimes but not Finder - and vice versa.
ncw
(Nick Craig-Wood)
June 17, 2023, 3:22pm
31
Do you want to write this up as an issue with suggestions on how to fix?
It wouldn't be too difficult to make VFS autonormalize I think
Will do - just need more experiments and tests before - so it will come at some stage soon.
Have updated fuse-t github ticket with some suggestions:
opened 10:39AM - 27 Feb 23 UTC
I am using FUSE-T with rclone. I am, however, 99% sure this is a FUSE-T issue an… d not rclone.
I have a file with the following character: `é`. That is `e + U+0301` or UTF8 encoded: `e\xcc\x81`. This consistently breaks listing the directory. If I change it to the normalized form `é` which is (U+00E9) or `\xc3\xa9` in UTF8, it works fine.
Rclone handles the name just fine in listing and I even see it in the rclone logs. I have the following files to demonstrate (I added around it to see if anything listed first):
Source Dir:
```
$ ls -1
before
test1 (e + U+0301) é.txt
test2 (U+00E9) é.txt
z-after
```
Mount Dir:
```
$ ls
ls: fts_read: Permission denied
```
The rclone `-vv` log is: [rclog.log](https://github.com/macos-fuse-t/fuse-t/files/10838709/rclog.log). This seems to indicate rclone isn't having the issue but rather FUSE-T.
Are there other tests I can do to assists? Additional logging? It is 100% reproducible on my machine so just let me know.
Hopefully it can be done as it would give us more options.
I am sort of sure that there is no perfect solution for this problem - but I hope that it can be made much less painful.
Extra mount options in fuse-t will give more ways to tackle it from rclone perspective.
@ncw - question - is it intentional that copy/move/sync do check normalised names but not copyto/movto?
E.g:
Using copyto I can create two files:
rclone lsf cc:TEST
CONFLICTéééFILE.txt
CONFLICTéééFILE.txt
one is NFC and one is NFD - and they happily coexist (works in crypt and in onedrive - does not in local macOS remote)
but if I try to copy this folder:
rclone copy cc:TEST cc:TEST2 --dry-run
2023/06/19 16:01:26 NOTICE: CONFLICTéééFILE.txt: Duplicate object found in source - ignoring
2023/06/19 16:01:26 NOTICE: CONFLICTéééFILE.txt: Skipped copy as --dry-run is set (size 0)
rclone does normalised names check and detects duplicates.
ncw
(Nick Craig-Wood)
June 20, 2023, 10:49am
35
Hmm, its probably an oversight. However I don't think we'll fix it.
copyto
is designed to copy the file with the minimal number of transactions and it is probably necessary to list the directory to fix normalization.
I have created new feature issue:
opened 08:56AM - 21 Jun 23 UTC
This has been discussed on the forum:
https://forum.rclone.org/t/possible-spe… cial-character-encoding-issue-on-macos/39048/30
At the moment many cloud storage destinations (and rclone virtual crypt remote) allow to store both NFC and NFD encoded files/directories names. Also rclone allows to upload/download both forms.
This in general works trouble free on Linux and Windows but breaks rclone mount functionality in macOS - depending on mount options either only NFC or only NFD content is visible/accessible - this is [unfortunate](https://eclecticlight.co/2021/05/08/explainer-unicode-normalization-and-apfs/) consequence macOS design decision to be different than rest of the world and use exclusively NFD in their APIs. We won't change it.
Experimentation and testing, including [attempts](https://github.com/macos-fuse-t/fuse-t/issues/16) to improve situation with FUSE-T (it has now - since v1.0.20 -`-o nfc` option which should help with NFC path) lead me to believe that last missing part of the puzzle is rclone VFS lack of normalization.
I would like to propose to add optional normalization to VFS.
New option:
--vfs-normalize OFF/NFC/NFD - with OFF being default
When set to NFC or NFD it would apply characters normalization to served content.
on fuse-t front since yesterday we have new option -o nfc
- it nicely makes macOS mount compatible with NFC content in VFS.
system
(system)
Closed
July 21, 2023, 8:59am
37
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.