Re: JFS default behavior (was: UTF-8 in file systems? xfs/extfs/etc.)

Jamie Lokier
2004-02-16T15:32:32Z

Valdis.Kletnieks@vt.edu wrote:
> > - in libc, implement a recoding function to convert file names from
> > LC_CTYPE to the underlying UTF-8 encoding
>
> Hmm.. could be fun if somebody is calling 'open', and the UTF-8 encoding
> requires the insertion of extra characters to encode it - what do you do then?

> That looks like a security hole just waiting to happen. Probably
> has lots of lurking corner cases too - what if you creat() a file,
> then do a readdir() and strcmp() each entry looking for your file
> (while comparing a filename smashed to UTF-8 to the original
> unsmashed string)?

Actually, following Eduard's proposal, that would work fine. The file
name would be passed to libc in the current encoding, created in
UTF-8, libc's readdir() would convert it back (which is always
possible without mangling), and strcmp() would be fine.

The real problem comes when you readdir() a directory which contains
non-UTF-8 names. Even if you changes your local filesystem, when you
go travelling an remotely-mounted filesystem elsewhere may have them.
What does Eduard's libc do then? Ignore the names? Mangle them?

Not to mention the extremely unpleasant performance implications.

-- Jamie