From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751394AbdBDSLP (ORCPT ); Sat, 4 Feb 2017 13:11:15 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:33455 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbdBDSLN (ORCPT ); Sat, 4 Feb 2017 13:11:13 -0500 X-IronPort-AV: E=Sophos;i="5.33,334,1477954800"; d="scan'208";a="212041947" Date: Sat, 4 Feb 2017 19:10:58 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Joe Perches cc: Guenter Roeck , Derek Robson , Julia Lawall , w.d.hubbs@gmail.com, chris@the-brannons.com, kirk@reisers.ca, samuel.thibault@ens-lyon.org, gregkh@linuxfoundation.org, shraddha.6596@gmail.com, alan@linux.intel.com, shiva@exdev.nl, amitoj1606@gmail.com, amsfield22@gmail.com, bhumirks@gmail.com, waltfeasel@gmail.com, speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: Staging: speakup - syle fix permissions to octal In-Reply-To: <1486193266.22276.82.camel@perches.com> Message-ID: References: <20170128060509.21260-1-robsonde@gmail.com> <20170204044403.GA2380@roeck-us.net> <1486193266.22276.82.camel@perches.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 3 Feb 2017, Joe Perches wrote: > (adding Julia Lawall) > > On Fri, 2017-02-03 at 20:44 -0800, Guenter Roeck wrote: > > On Sat, Jan 28, 2017 at 07:05:09PM +1300, Derek Robson wrote: > > > A style fix across whole driver. > > > changed permissions to octal style, found using checkpatch > > > > > > Signed-off-by: Derek Robson > > > > FWIW, I think changes like this are best done using coccinelle. > > I think checkpatch does it reasonably well. > > Julia? Can coccinelle do this? > > I believe cocinelle doesn't handle the substitution > and octal addition very well when multiple flags > are used. OK, finally received. I think that Guenter's solution is a good one, because the rule-writer knows better than Coccinelle what people find to be intelligible. julia > > > That ensures that the results can be reproduced and are well defined. > > As it is, someone will have to check each line of your patches to ensure > > that the conversion is correct. > > > > It would also ensure (hopefully) that we don't end up with constructs > > such as > > > > > -#define USER_R (S_IFREG|S_IRUGO) > > > -#define USER_W (S_IFREG|S_IWUGO) > > > +#define USER_R (S_IFREG|0444) > > > +#define USER_W (S_IFREG|0666) > > > > which really defeat the purpose of the whole exercise. > > Why do you think mixing file specific attributes > with octal permissions is a bad thing? > > $ git log -1 f90774e1fd2700d > commit f90774e1fd2700de4a6e0d62866d34a26c544bd0 > Author: Joe Perches > Date: Tue Oct 11 13:51:47 2016 -0700 > > checkpatch: look for symbolic permissions and suggest octal instead > > S_ uses should be avoided where octal is more intelligible. > > Linus didst say: > > : It's *much* easier to parse and understand the octal numbers, while the > : symbolic macro names are just random line noise and hard as hell to > : understand. You really have to think about it. > : > : So we should rather go the other way: convert existing bad symbolic > : permission bit macro use to just use the octal numbers. > : > : The symbolic names are good for the *other* bits (ie sticky bit, and the > : inode mode _type_ numbers etc), but for the permission bits, the symbolic > : names are just insane crap. Nobody sane should ever use them. Not in the > : kernel, not in user space. > (http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com) > > Link: http://lkml.kernel.org/r/7232ef011d05a92f4caa86a5e9830d87966a2eaf.1470180926.git.joe@perches.com > Signed-off-by: Joe Perches > Cc: Linus Torvalds > Signed-off-by: Andrew Morton > Signed-off-by: Linus Torvalds >