TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

57 pointsby sslalreadyalmost 9 years ago

12 comments

DblPlusUngoodalmost 9 years ago
Linus&#x27; reply: &quot;I detest these patches.&quot;<p><a href="https:&#x2F;&#x2F;lkml.org&#x2F;lkml&#x2F;2016&#x2F;8&#x2F;2&#x2F;1589" rel="nofollow">https:&#x2F;&#x2F;lkml.org&#x2F;lkml&#x2F;2016&#x2F;8&#x2F;2&#x2F;1589</a>
评论 #12214335 未加载
abstractbeliefsalmost 9 years ago
Another option to understand the magnitude of this fuck up is to have a look at today&#x27;s chronological email list: <a href="https:&#x2F;&#x2F;lkml.org&#x2F;lkml&#x2F;2016&#x2F;8&#x2F;2&#x2F;" rel="nofollow">https:&#x2F;&#x2F;lkml.org&#x2F;lkml&#x2F;2016&#x2F;8&#x2F;2&#x2F;</a>
评论 #12216418 未加载
SloopJonalmost 9 years ago
It&#x27;s an interesting question as to which is more readable:<p><pre><code> -module_param(max_sets, int, 0600); +module_param(max_sets, int, S_IRUSR | S_IWUSR); </code></pre> However, I&#x27;m missing context. Did someone at Intel really spam 1,285 patches without any prior discussion?
评论 #12214108 未加载
评论 #12214036 未加载
jxyalmost 9 years ago
I can understand that for someone has no background or long term use of chmod(1) would need some effort to decipher what 0644 actually means. However, for people who are well versed in this aspect, the numerical code is much easier to parse.<p>This reminds me of constantly looking up j dict [0] before I could remember what each number means. J&#x27;s foreign conjunction is certainly an extreme here, but it teaches me that what is easy to parse really depends on one&#x27;s proficiency in the language.<p>[0] <a href="http:&#x2F;&#x2F;www.jsoftware.com&#x2F;help&#x2F;dictionary&#x2F;dx001.htm" rel="nofollow">http:&#x2F;&#x2F;www.jsoftware.com&#x2F;help&#x2F;dictionary&#x2F;dx001.htm</a>
评论 #12216320 未加载
评论 #12215435 未加载
pavlovalmost 9 years ago
The octal representation is such a deep-grained part of Unix on all levels (both C and shell) that replacing it is futile. These weird 0-prefixed octal constants will still be in common use a hundred years from now, for better and worse.<p>Also, it&#x27;s not easy to argue that &quot;S_IRUSR | S_IRGRP | S_IROTH&quot; is any kind of readability improvement...
cm3almost 9 years ago
Linus is right because these are actually well known and easy to parse.<p>However, if instead of S_IRUSR|S_IWUSR (which I&#x27;d have to lookup up to parse correctly), it were possible to write &quot;a-rwx&quot;|&quot;u+rw&quot;, it would be even easier to parse, without the need to memorize common octal numbers. In C, this could be achieved with the preprocessor, I believe, if you create a sufficiently smart CPP macro, especially since Linux is no stranger to heavy preprocessor use.
评论 #12215239 未加载
Artlavalmost 9 years ago
Sounds like someone ran a script without thinking too much.
0x0almost 9 years ago
Shameful to see @intel.com in the signed-off-by on this spam train
评论 #12214612 未加载
评论 #12214344 未加载
评论 #12214343 未加载
raldialmost 9 years ago
The macros are for when you&#x27;re <i>reading</i> the value, not setting it:<p><pre><code> if(m &amp; S_IRUSR) { ... }</code></pre>
评论 #12214864 未加载
chjalmost 9 years ago
These numbers are almost hardwired in my brain and I am not even a kernel developer. I think most kernel developers should not need the help of these magic macros.
jlgaddisalmost 9 years ago
I&#x27;d be curious to see a graph of the load average on vger.kernel.org today. I can imagine a huge spike lasting several hours.
YeGoblynQueennealmost 9 years ago
Why did each of those need to be a simple patch? Couldn&#x27;t they be just one big patch, which would have been a little easier to read?<p>(kernel muggle here, mind)
评论 #12216721 未加载