[Linux-kernel-mentees] [RFC PATCH] checkpatch: add shebang check to EXECUTE_PERMISSIONS
ujjwalkumar0501 at gmail.com
Sun Oct 11 16:40:07 UTC 2020
On 11/10/20 9:51 pm, Ujjwal Kumar wrote:
> checkpatch script checks for invalid EXECUTE_PERMISSIONS on source
> files. The script leverages filename extensions and its path in
> the repository to decide whether to allow execute permissions on
> the file or not.
> Based on current check conditions, a perl script file without
> '.pl' extension in its filename and not belonging to 'scripts/'
> directory is reported as ERROR which is a false-positive.
> The script can correctly handle patches with mode changes and
> shebang line if shebang is taken into account. So, along with
> the current check conditions, adding the shebang check in the
> check conditions can improve the reports of the script.
> Signed-off-by: Ujjwal Kumar <ujjwalkumar0501 at gmail.com>
> scripts/checkpatch.pl | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
To test the changes, I used the following scripts:
for i in $(find -executable -type f | grep "\.[a-z]" -v | grep "scripts/" -v); \
hs=$(git log --reverse --format=%H $i | head -1); \
echo $hs; \
done | sort | uniq | \
xargs -n1 -P7 scripts/checkpatch.pl --show-types --types EXECUTE_PERMISSIONS --terse -g
Before patching, the script shows 21 false-positives.
After applying the patch, the ERRORS are gone.
More information about the Linux-kernel-mentees