From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751174AbdBDPZY (ORCPT ); Sat, 4 Feb 2017 10:25:24 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:42988 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbdBDPZX (ORCPT ); Sat, 4 Feb 2017 10:25:23 -0500 X-IronPort-AV: E=Sophos;i="5.33,334,1477954800"; d="scan'208";a="258845570" Date: Sat, 4 Feb 2017 16:25:20 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Guenter Roeck cc: Julia Lawall , Joe Perches , 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 Subject: Re: Staging: speakup - syle fix permissions to octal In-Reply-To: <73e1fc67-804c-ba28-178f-82224c54bb7c@roeck-us.net> Message-ID: References: <20170128060509.21260-1-robsonde@gmail.com> <20170204044403.GA2380@roeck-us.net> <1486193266.22276.82.camel@perches.com> <73e1fc67-804c-ba28-178f-82224c54bb7c@roeck-us.net> 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 Sat, 4 Feb 2017, Guenter Roeck wrote: > On 02/04/2017 06:29 AM, Julia Lawall wrote: > > > > > > On Sat, 4 Feb 2017, Guenter Roeck wrote: > > > > > On 02/03/2017 11:27 PM, 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. > > > > > > > > > > Why not ? Seems to be quite simple. One just has to list all the variants > > > being used in the rule. > > > > > > > > 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? > > > > > > > > > > Just an assumption. My bad. Ultimately, what I think doesn't really > > > matter, though - because what I think is that the whole "use octals" > > > is a bad idea to start with. > > > > I don't think I have received yet the message that this is referring to. > > But I don't see a problem for Coccinelle a priori. If there are things > > that need to be added together, as long as they are explicit constants, > > that can be done in python or ocaml. > > > > Something like > > @@ > @@ > > ( > - S_IFREG | S_IRUGO | S_IWUGO > + S_IFREG | 0666 > | > - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH > + 0644 > | > - S_IRUGO|S_IWUSR > + 0644 > | > - S_IWUSR|S_IRUGO > + 0644 > | > - S_IRUGO|S_IWUGO > + 0666 > | > - S_IWUGO|S_IRUGO > + 0666 > | > - S_IRUGO > + 0444 > | > - S_IWUGO > + 0222 > | > - S_IWUSR > + 0200 > ) > > Odd is that the S_IFREG rule seems to be needed to catch "S_IFREG | S_IRUGO | > S_IWUGO", > but probably I am missing something as usual ;-). The associativity of | is not what you hope for. julia