ruanimal / nfs4j-daemon

Pure Java NFS v3/v4.1 server backed by dCache nfs4j
Apache License 2.0
3 stars 1 forks source link

LOOKUP bug when filename contains NFC(Normalization Form C) characters #3

Open ruanimal opened 1 year ago

ruanimal commented 1 year ago

It looks like macOS client transform all NFC characters to NFD, this cause NFS3ERR_NOENT represented by NoEntException if filename contains NFC.

>>> import json, unicodedata

>>> print(json.dumps('ぶ'))
"\u3076"

>>> print(json.dumps(unicodedata.normalize('NFD', 'ぶ')))
"\u3075\u3099"

>>> unicodedata.normalize('NFD', 'ぶ')
'ぶ'

>>> 'ぶ' == 'ぶ'
False

ref:

ruanimal commented 1 year ago

see also https://www.reddit.com/r/DataHoarder/comments/ffqnra/making_smbnfsafp_shares_unicode_normalisation/ https://www.truenas.com/docs/scale/scaletutorials/shares/smb/smbusingdecomposedunicode/ https://geraldonit.com/2020/02/08/apple-afp-to-smb-migration-removing-appledouble-and-_-files-and-converting-file-names-from-unicode-nfd-to-nfc/

ruanimal commented 1 year ago

workaround https://github.com/ruanima/unicode-normalizer