Re: [PATCH 0002/1285] Replace numeric parameter like 0444 with macro

From: Austin S. Hemmelgarn
Date: Tue Aug 02 2016 - 10:41:41 EST


On 2016-08-02 06:33, Baole Ni wrote:
I find that the developers often just specified the numeric value
when calling a macro which is defined with a parameter for access permission.
As we know, these numeric value for access permission have had the corresponding macro,
and that using macro can improve the robustness and readability of the code,
thus, I suggest replacing the numeric parameter with the macro.
Have you taken the time to consider _why_ this is common practice? In most cases, people who have been using UNIX-like systems for any reasonable period of time can mentally parse the octal permissions almost instantly, while it often takes them a while to figure out the macros. So, overall, this change actually hurts readability for a large number of people.

Additionally, the argument of robustness is somewhat bogus too, the internal representation of POSIX DAC permissions is not going to change any time soon, if at all, so abstracting the values away isn't really improving robustness considering that what it's supposed to protect against won't ever happen.

Beyond that, there are also a number of other issues with the set as a whole:
1. In many places, you haven't properly re-wrapped lines at the 80 column limit.
2. In many places, you haven't condensed macros like you should (for example, 0644 should be (S_IWUSR | S_IRUGO), not (S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH), and this would help with the line length limit too).
3. You're missing subsystem tags in your patch subjects.
4. Patches shouldn't be per-file for changes like this, they should be per-subsystem. Dropping this many patches (you've sent more patches in a few hours than the whole sees in a day on average) is a very good way to get people to ignore you.