From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753840AbdBDH1x (ORCPT ); Sat, 4 Feb 2017 02:27:53 -0500 Received: from smtprelay0197.hostedemail.com ([216.40.44.197]:36526 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753804AbdBDH1w (ORCPT ); Sat, 4 Feb 2017 02:27:52 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2525:2553:2561:2564:2682:2685:2691:2692:2693:2828:2859:2902:2903:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3770:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:5007:6119:6691:6742:7266:7514:9025:9108:9121:10004:10400:10848:11232:11233:11256:11257:11658:11914:12043:12262:12438:12555:12679:12740:12760:12783:12895:12986:13439:13846:14096:14097:14181:14659:14721:14849:21080:21365:21433:21451:30030:30034:30051:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:10,LUA_SUMMARY:none X-HE-Tag: cook19_27099cd71db31 X-Filterd-Recvd-Size: 3745 Message-ID: <1486193266.22276.82.camel@perches.com> Subject: Re: Staging: speakup - syle fix permissions to octal From: Joe Perches To: Guenter Roeck , Derek Robson , Julia Lawall Cc: 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 Date: Fri, 03 Feb 2017 23:27:46 -0800 In-Reply-To: <20170204044403.GA2380@roeck-us.net> References: <20170128060509.21260-1-robsonde@gmail.com> <20170204044403.GA2380@roeck-us.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (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. > 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