From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751386AbdBDTaV (ORCPT ); Sat, 4 Feb 2017 14:30:21 -0500 Received: from smtprelay0157.hostedemail.com ([216.40.44.157]:50845 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750876AbdBDTaU (ORCPT ); Sat, 4 Feb 2017 14:30:20 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2553:2559:2562:2691:2828:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4470:5007:6742:7514:7904:9108:10004:10226:10400:10450:10455:10848:10946:11232:11658:11914:12663:12740:12760:12895:13161:13229:13439:14096:14097:14181:14659:14721:19904:19999:21080:21324:30012: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:2,LUA_SUMMARY:none X-HE-Tag: laugh11_598ac01878c08 X-Filterd-Recvd-Size: 3568 Message-ID: <1486236613.22276.90.camel@perches.com> Subject: Re: Staging: speakup - syle fix permissions to octal From: Joe Perches To: Julia Lawall Cc: Guenter Roeck , Derek Robson , 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: Sat, 04 Feb 2017 11:30:13 -0800 In-Reply-To: References: <20170128060509.21260-1-robsonde@gmail.com> <20170204044403.GA2380@roeck-us.net> <1486193266.22276.82.camel@perches.com> <1486233168.22276.88.camel@perches.com> 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 On Sat, 2017-02-04 at 20:24 +0100, Julia Lawall wrote: > > On Sat, 4 Feb 2017, Joe Perches wrote: > > > On Sat, 2017-02-04 at 19:10 +0100, Julia Lawall wrote: > > > > > > 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. > > > > If it's written in python, I don't see how that's > > particularly different than being written in perl, > > but coccinelle could certainly handle expressions > > on multiple lines of these or'd constants better. > > Well, the python would only be needed if there was a need for actual > calculations. Should S_IRGRP | S_IWGRP become 0060? Yes. > > Are there any than span 2 or more lines? > > I didn't see one with a casual grep. > > > > Does coccinelle handle arbitrary ordering of these > > constants in a form like Guenter suggests or does > > each possible ordered sequence need to be written? > > There is the following isomorphism: > > X | Y => Y | X > > But that only works when the associativity is right. > > A | B | C is (A | B) | C, so the B and C won't exchange with each other. > One can also write eg > > A | ... | B > > which gives more fexibility. I'm not sure to what extent that works when > there are changes, though. The perl code doesn't care about the ordering but it doesn't handle the A | ... | B case.