On Linux, some of our os methods use .NET methods while others use Mono.Unix.Native.Syscall. For example, os.mkdir uses the .NET Directory.CreateDirectory, but os.stat uses Syscall.stat. It appears that the string marshalling used by .NET and Mono.Unix is different (only?) for unencodable characters. This causes unexpected exceptions:
import os
f = '\udcff'
os.mkdir(f)
os.stat(f) # raises FileNotFoundError
os.rmdir(f)
Similarly for other calls that use Syscall behind the scenes, such as os.open which uses Syscall.open.
I only tested this with .NET 10 on Linux so it's possible Mono doesn't have this issue? Note that during my testing Directory.CreateDirectory, Syscall.mkdir and the CPython (3.12) os.mkdir all created different folders for the \udcff filename. I'm just noting the difference with CPython because I noticed it, my main concern is incompatibility with our own os methods. Although in practice it's probably all irrelevant. 😄
On Linux, some of our
osmethods use .NET methods while others useMono.Unix.Native.Syscall. For example,os.mkdiruses the .NETDirectory.CreateDirectory, butos.statusesSyscall.stat. It appears that the string marshalling used by .NET andMono.Unixis different (only?) for unencodable characters. This causes unexpected exceptions:Similarly for other calls that use
Syscallbehind the scenes, such asos.openwhich usesSyscall.open.I only tested this with .NET 10 on Linux so it's possible Mono doesn't have this issue? Note that during my testing
Directory.CreateDirectory,Syscall.mkdirand the CPython (3.12)os.mkdirall created different folders for the\udcfffilename. I'm just noting the difference with CPython because I noticed it, my main concern is incompatibility with our ownosmethods. Although in practice it's probably all irrelevant. 😄