mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Derek Robson <robsonde@gmail.com>,
	Julia Lawall <julia.lawall@lip6.fr>
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
Subject: Re: Staging: speakup - syle fix permissions to octal
Date: Fri, 03 Feb 2017 23:27:46 -0800	[thread overview]
Message-ID: <1486193266.22276.82.camel@perches.com> (raw)
In-Reply-To: <20170204044403.GA2380@roeck-us.net>

(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 <robsonde@gmail.com>
> 
> 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 <joe@perches.com>
Date:   Tue Oct 11 13:51:47 2016 -0700

    checkpatch: look for symbolic permissions and suggest octal instead
    
    S_<FOO> 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 <joe@perches.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

  reply	other threads:[~2017-02-04  7:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-28  6:05 [PATCH] " Derek Robson
2017-01-28  6:14 ` Joe Perches
2017-02-04  4:44 ` Guenter Roeck
2017-02-04  7:27   ` Joe Perches [this message]
2017-02-04 14:22     ` Guenter Roeck
2017-02-04 14:29       ` Julia Lawall
2017-02-04 15:17         ` Guenter Roeck
2017-02-04 15:25           ` Julia Lawall
2017-02-04 18:10     ` Julia Lawall
2017-02-04 18:32       ` Joe Perches
2017-02-04 19:24         ` Julia Lawall
2017-02-04 19:30           ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486193266.22276.82.camel@perches.com \
    --to=joe@perches.com \
    --cc=alan@linux.intel.com \
    --cc=amitoj1606@gmail.com \
    --cc=amsfield22@gmail.com \
    --cc=bhumirks@gmail.com \
    --cc=chris@the-brannons.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robsonde@gmail.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=shiva@exdev.nl \
    --cc=shraddha.6596@gmail.com \
    --cc=speakup@linux-speakup.org \
    --cc=w.d.hubbs@gmail.com \
    --cc=waltfeasel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome