cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
835 stars 114 forks source link

umask always zero? #256

Open smessmer opened 1 year ago

smessmer commented 1 year ago

I checked the calls I'm getting in mkdir and create, and it seems that the calling process's umask is already automatically applied to the mode argument and the additional umask argument is always set to zero. Is this intentional? What is the umask argument supposed to be used for?

Fuser: 0.12.0 Filesystem setup: fuser::spawn_mount2 with empty set of options

GermanCoding commented 1 year ago

Looking at fuse configuration, it looks like this is configurable behaviour since ~ABI 7.12: The default seems to be that the kernel applies the umask for you, probably giving you a zero for the umask to ensure compatibility.

However, if you set FUSE_DONT_MASK during filesystem init (https://github.com/libfuse/libfuse/blob/9ca35f454f61df81af9bcb315908819fd2100696/include/fuse_kernel.h#L335, https://github.com/cberner/fuser/blob/8b390279a5da98df3f91b69aee8ef20de793a2fa/src/ll/fuse_abi.rs#L196), the umask should not be applied automatically by the kernel, and may thus be non-zero (note that a zero umask may be used by the process as well).