Re: msdosfs: Lookup of some existing files fails when mounting with long names

Stefan Esser <[email protected]> Fri, 22 May 2026 18:10:59 +0200
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
Am 21.05.26 um 23:56 schrieb [email protected]:
> Fabian sent me the relevant part of the image, and the name
> that is not correctly displayed contains the following UTF-16
> sequence:
> 
>      U+D83E U+DD10 ===> U+1F910 ===> "🤐"
> 
> Seems that the conversion of these combined UTF-16 sequences
> (surrogates) is not correct. This will probably affect all
> file names that contain Unicode characters that cannot be
> encoded in a single UTF-16 value.
> 
> I'm going to further debug this issue tomorrow; it should be
> easy to reproduce and fix ...

I had time to look at the sources and found that the function
win2unixchr() does not support surrogates.

The problem with surrogates in file names is that they can be
split between VFAT directory entry elements (i.e., last symbol
in one group of 13, and first symbol in the preceding group of
13 symbols). But each 13 symbols are currently processed with
no state kept between them.

I'll come up with a patch for review when I have decided how
to keep the first surrogate symbol and to present it when
the second surrogate is processed (possibly only in the next
invocation of win2unixfn(), which causes this problem).