[LTP] [PATCH] mount03: Convert to new API
xuyang2018.jy@fujitsu.com
xuyang2018.jy@fujitsu.com
Tue Aug 16 11:53:47 CEST 2022
Hi All
>> Hi!
>>> @Richie @Li @Metan: There are checkpatch.pl warnings. Yes, kernel folks does not
>>> like permission warnings. Do we want to follow? Or should we remove these from
>>> our checkpatch.pl fork (we use constants in many places)?
>
>>> $ make check-mount03
>>> mount03.c:29: WARNING: Symbolic permissions 'S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH' are not preferred. Consider using octal permissions '0644'.
>>> mount03.c:30: WARNING: Symbolic permissions 'S_IRUSR|S_IXUSR|S_IXGRP|S_IXOTH' are not preferred. Consider using octal permissions '0511'.
>>> mount03.c:50: WARNING: static char array declaration should probably be static const char
>>> mount03.c:103: WARNING: Symbolic permissions 'S_IRWXU' are not preferred. Consider using octal permissions '0700'.
>>> mount03.c:114: WARNING: Symbolic permissions 'S_IRWXU' are not preferred. Consider using octal permissions '0700'.
>>> mount03.c:125: WARNING: Symbolic permissions 'S_IRWXU' are not preferred. Consider using octal permissions '0700'.
>>> mount03.c:181: WARNING: Symbolic permissions 'S_IRWXU' are not preferred. Consider using octal permissions '0700'.
>>> mount03.c:204: WARNING: Symbolic permissions 'S_IRWXU' are not preferred. Consider using octal permissions '0700'.
>
>> To be honest I think Linus is right at this one, the single octal number
>> is way more readable than the bitwise or of four constants, so I would
>> be inclined to start following the kernel practice here.
>
> Agree with the rule, numbers are indeed much readable and I'm for using it in
> LTP source.
Linux checkpatch.pl only think perms should use octal number, but not
inlcude sticky bits, set-uid bit setgid bit and file types[1].
Should we modify checkpatch.pl to print only three bit instead of four
bits because setgid bit setuid bit sticky bit are stil keep symbolic names .
[1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.0-rc1&id=f90774e1fd2700de4a6e0d62866d34a26c544bd0
Best Regards
Yang Xu
>
> My concern was different: aren't these constants part of POSIX? See man from
> <sys/stat.h> from 1997 [1]. There might be a test for these constants but
> it has much lower priority than tests for new kernel functionality and CVE.
>
> Kind regards,
> Petr
>
> [1] https://pubs.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html
>
More information about the ltp
mailing list