The key is that the umask ("user mask") is intended to keep processes from creating files with permission bits they're not supposed to use. If you look at it from that perspective, the concept of a umask may make more sense; in particular, the common umask of 022 prevents processes from creating files that are writable by group or world, which is usually what you want.
The input value is octal which may require a leading 0 to be parsed correctly. As the owner mask is almost always 0 the mask can be entered with three digits. As an AND mask, it would need to be entered as 0755 or 0750.
Defining it as an AND NOT operation makes it safer if characters are missed in the mask. If umask was and AND operation umask 5 would allow only limited world access and umask 0 would be even worse. umasq 75 parsed as a decimal value would be be effectively umask 113 which would not allow read acces.
EDIT: From another perspective, the mask is a list of the bits you want masked off. Therefore you want masks like 026 rather than 0751. Internal representation may well be 07751 or what ever is appropriate for ANDing. If not, the conversion is relatively trivial, and in the grand scheme of things the mask doesn't get applied that often.
The key is that the umask ("user mask") is intended to keep processes from creating files with permission bits they're not supposed to use. If you look at it from that perspective, the concept of a umask may make more sense; in particular, the common umask of 022 prevents processes from creating files that are writable by group or world, which is usually what you want.
The input value is octal which may require a leading 0 to be parsed correctly. As the owner mask is almost always 0 the mask can be entered with three digits. As an AND mask, it would need to be entered as 0755 or 0750.
Defining it as an AND NOT operation makes it safer if characters are missed in the mask. If umask was and AND operation
umask 5
would allow only limited world access andumask 0
would be even worse.umasq 75
parsed as a decimal value would be be effectivelyumask 113
which would not allow read acces.EDIT: From another perspective, the mask is a list of the bits you want masked off. Therefore you want masks like
026
rather than0751
. Internal representation may well be07751
or what ever is appropriate for ANDing. If not, the conversion is relatively trivial, and in the grand scheme of things the mask doesn't get applied that often.