Re: [PATCH 3/4] scripts: checkpatch.pl: don't complain that debian/rules is executable

From: Joe Perches
Date: Tue Jul 09 2019 - 06:16:32 EST


On Tue, 2019-07-09 at 11:32 +0200, Enrico Weigelt, metux IT consult
wrote:
> checkpatch.pl complains when adding executable "debian/rules",
> obviously a false alarm. Therefore add an exception for that.
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@xxxxxxxxx>
> ---
> scripts/checkpatch.pl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 342c7c7..caf0146 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2587,6 +2587,7 @@ sub process {
> if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
> my $permhere = $here . "FILE: $realfile\n";
> if ($realfile !~ m@scripts/@ &&
> + $realfile !~ "debian/rules" &&
> $realfile !~ /\.(py|pl|awk|sh)$/) {
> ERROR("EXECUTE_PERMISSIONS",
> "do not set execute permissions for source files\n" . $permhere);

There are several of these scripts that have
no filename extension type and I suspect just
adding debian/rules isn't all that valuable.

$ git ls-files -s | grep '^100755' | grep -vP '\.(py|pl|awk|sh)$' | grep -v 'scripts/'
100755 b803f4f886b5e5e4046daedbd516e894f0f7e897 0 Documentation/target/target-export-device
100755 532d458333965b80f8f3ea149ad705208893b58f 0 arch/powerpc/boot/wrapper
100755 fbac1732f874e8d117b9c4aaf0a66b203370b933 0 arch/s390/kernel/syscalls/syscalltbl
100755 47c481239e986c35ba4818cb3e96f9ba7a813c2e 0 drivers/staging/greybus/tools/lbtest
100755 d7fc32ea8ac224f0fb6f28c58b196c665e510992 0 lib/build_OID_registry
100755 030a60b0404632ed598e5f5b56267e2a6af4b25f 0 samples/mic/mpssd/micctrl
100755 248ac7313c714d7acb29ceaaadd8fc8ee484e85e 0 samples/mic/mpssd/mpss
100755 2240cb56e6e5e6ed30a75913d4d5fecbb8f193c3 0 tools/debugging/kernel-chktaint
100755 ad1b9e646c4913b31aab9696245bc94b661647ff 0 tools/kvm/kvm_stat/kvm_stat
100755 49af9fe19f5b0533b64c117a363fc1c3785fa1da 0 tools/lib/lockdep/lockdep
100755 459469b7222c1410f7a701561eec004d86568369 0 tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
100755 6c58060aa03beae7456e4f7cb0588e70207314be 0 tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl
100755 72ecbb67637079f709262298981162b6cbb12c9f 0 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
100755 fae26b1cf08f50a8c0caacf7bc0715e948ef0c03 0 tools/perf/tests/perf-targz-src-pkg
100755 3802cee5e1887f5b406324484832305e4a1b29b6 0 tools/perf/util/PERF-VERSION-GEN
100755 6d5e9e87c4b7f51f5904d17fa016a134563ba0d0 0 tools/testing/selftests/ftrace/ftracetest
100755 ea5938ec009a5eb9e28cb1778e081a568e66fd65 0 tools/testing/selftests/net/run_afpackettests
100755 14e41faf2c5740633f9dd30e500543647b736734 0 tools/testing/selftests/net/run_netsocktests
100755 4509f0cc9c918d33c39caf3372f2bcdfc81bceff 0 tools/testing/selftests/pstore/common_tests
100755 2a329bbb4aca3ad391a5aca9a67f554b060fdca2 0 tools/testing/selftests/pstore/pstore_crash_test
100755 d6da5e86efbf89c7f4d7454d9a2c6a11ef2ea9e4 0 tools/testing/selftests/pstore/pstore_post_reboot_tests
100755 1cef54458aff916b2f00af33deef703cb3101ab0 0 tools/testing/selftests/pstore/pstore_tests
100755 951c507a27f7df05f82ce2de78abba2e0d9848f4 0 tools/testing/selftests/vm/run_vmtests

Maybe setting an internal flag and looking at the file content
for a shebang might be better.

$ git ls-files -s | grep '^100755' | grep -vP '\.(py|pl|awk|sh)$'|grep -v 'scripts/'|awk '{print $4}'|while read file ; do echo "$file $(head -2 $file | grep '#!')" ; done
Documentation/target/target-export-device #!/bin/sh
arch/powerpc/boot/wrapper #!/bin/sh
arch/s390/kernel/syscalls/syscalltbl #!/bin/sh
drivers/staging/greybus/tools/lbtest #!/usr/bin/env python
lib/build_OID_registry #!/usr/bin/perl -w
samples/mic/mpssd/micctrl #!/bin/bash
samples/mic/mpssd/mpss #!/bin/bash
tools/debugging/kernel-chktaint #! /bin/sh
tools/kvm/kvm_stat/kvm_stat #!/usr/bin/env python3
tools/lib/lockdep/lockdep #!/bin/bash
tools/perf/arch/arm64/entry/syscalls/mksyscalltbl #!/bin/sh
tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl #!/bin/sh
tools/perf/arch/s390/entry/syscalls/mksyscalltbl #!/bin/sh
tools/perf/tests/perf-targz-src-pkg #!/bin/sh
tools/perf/util/PERF-VERSION-GEN #!/bin/sh
tools/testing/selftests/ftrace/ftracetest #!/bin/sh
tools/testing/selftests/net/run_afpackettests #!/bin/sh
tools/testing/selftests/net/run_netsocktests #!/bin/sh
tools/testing/selftests/pstore/common_tests #!/bin/sh
tools/testing/selftests/pstore/pstore_crash_test #!/bin/sh
tools/testing/selftests/pstore/pstore_post_reboot_tests #!/bin/sh
tools/testing/selftests/pstore/pstore_tests #!/bin/sh
tools/testing/selftests/vm/run_vmtests #!/bin/bash