Re: [PATCH] checkpatch: fix false positive for REPEATED_WORD warning
From: Joe Perches
Date: Wed Oct 21 2020 - 16:37:07 EST
On Wed, 2020-10-21 at 12:26 -0700, Joe Perches wrote:
> Perhaps a regex for permissions is good enough
> $line !~ /\b[cbdl-][rwxs-]{9,9}\b/
Maybe not completely correct...
>From info ls:
The file type is one of the following characters:
‘-’
regular file
‘b’
block special file
‘c’
character special file
‘C’
high performance (“contiguous data”) file
‘d’
directory
‘D’
door (Solaris 2.5 and up)
‘l’
symbolic link
‘M’
off-line (“migrated”) file (Cray DMF)
‘n’
network special file (HP-UX)
‘p’
FIFO (named pipe)
‘P’
port (Solaris 10 and up)
‘s’
socket
‘?’
some other file type
The file mode bits listed are similar to symbolic mode
specifications (*note Symbolic Modes::). But ‘ls’ combines
multiple bits into the third character of each set of permissions
as follows:
‘s’
If the set-user-ID or set-group-ID bit and the corresponding
executable bit are both set.
‘S’
If the set-user-ID or set-group-ID bit is set but the
corresponding executable bit is not set.
‘t’
If the restricted deletion flag or sticky bit, and the
other-executable bit, are both set. The restricted deletion
flag is another name for the sticky bit. *Note Mode
Structure::.
‘T’
If the restricted deletion flag or sticky bit is set but the
other-executable bit is not set.
‘x’
If the executable bit is set and none of the above apply.
‘-’
Otherwise.
So apparently to be correct this should be:
$line !~ /\b[bcCdDlMnpPs\?-][rwxsStT-]{9,9}\b/