Re: [PATCH] scripts/checkpatch.pl: Warn on non-executable filescreated with non 100644 file permissions

From: Wolfram Sang
Date: Thu Oct 07 2010 - 02:54:46 EST


On Wed, Oct 06, 2010 at 04:31:31PM -0700, Joe Perches wrote:
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> scripts/checkpatch.pl | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2039acd..6f8a1d4 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1346,6 +1346,14 @@ sub process {
> }
> }
>
> + if ($rawline =~ /^ create mode (\d+) ([\w\.\/\-]+)$/) {

Do you really need to escape ./- in the character-class? ISTR this is not
needed.

> + my $mode = $1;
> + my $file = $2;
> + if ($mode ne "100644" && !($file =~ /\.(sh|pl|py|awk)$/)) {
> + WARN("FILE '$file' should probably use file permission 100644 not $mode\n" . $herecurr);
> + }

What about checking for no filename extension, too, and changing the message to
something like "use proper file permission or proper extension"?

> + }
> +
> # Check for wrappage within a valid hunk of the file
> if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
> ERROR("patch seems to be corrupt (line wrapped?)\n" .
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |

Attachment: signature.asc
Description: Digital signature