6 ms·
I would refuse any PR that used octal unnecessarily, and I generally ask people to use chmod plus-addressing rather than octal where possible, so that there’s a
by floatingatoll 5y ago
I would refuse any PR that used octal unnecessarily, and I generally ask people to use chmod plus-addressing rather than octal where possible, so that there’s a lower risk of math errors and a higher chance of good review.
0644|0755: a=rX,u+w
0600: u=rw
Etc.
- broodbucket 5y agoThis is funny for me to read because I converted a bunch of constants for file permissions to octal values in the Linux kernel because they're harder to read and there's multiple ways of arriving at the same value. You wanna look up what a constant is and you find #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) or you could see 0444 and immediately know what it means. I agree in cases where you're modifying existing permissions it's much better to do a `chmod u+w` than to replace the whole thing with octal. When you're defining permissions at the time of creation though, everyone can parse 0644 at a glance. a=rX,u+w isn't so bad but I don't know if I'd prefer it personally, in code where you can't use chmod syntax I'm definitely preferring octal.
- floatingatoll 5y agoHow do you represent a=rX in octal?
- broodbucket 5y agoOh, I didn't know what X did and made assumptions. If you split file permissions into two halves - defining the initial permissions / modifying something that already exists - I can see how it makes sense to do both with the same syntax since modifying existing permissions is worse with octal.