luvit / luv

Bare libuv bindings for lua
Apache License 2.0
831 stars 187 forks source link

docs: Clarify types for mode arg in some filesystem functions #703

Closed adigitoleo closed 5 months ago

adigitoleo commented 5 months ago

Some libuv filesystem functions expect the numeric mode argument to be an octal representation of the equivalent chmod(1) mode. This is potentially surprising behaviour to anyone who hasn't used either libuv or glibc from C. The documentation for e.g. fs_mkdir in libuv defers to mkdir(2) which defers to mode_t(3) which only says "It is an integer type". Furthermore, fs_access uses a different mode type, validated using luv_check_amode, which can accept strings ("symbolic mode" in chmod(1)). I chose not to mention that this one still technically accepts an integer because I have no idea about the restrictions of said integer.

adigitoleo commented 5 months ago

Added example usages as per review comment. 755 for mkdir instead of 644 (that is the usual directory permission code on Linux).