diff options
author | B. Watson <urchlay@slackware.uk> | 2024-10-09 20:02:17 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-10-09 20:02:17 -0400 |
commit | e26cd076e322b636438e0a9570434a8135af32a4 (patch) | |
tree | 77fbec0e159d20ef79d7e7a90ef33c2f6e97fa5a /sbolint | |
parent | 756d134a3b8c03881461c3f63ca36bb88370a954 (diff) | |
download | sbo-maintainer-tools-e26cd076e322b636438e0a9570434a8135af32a4.tar.gz |
sbolint: tighten up chown . checking (still not happy with it).
Diffstat (limited to 'sbolint')
-rwxr-xr-x | sbolint | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1465,8 +1465,26 @@ sub check_script { $makepkg = $lineno; } elsif(/^\s*?CWD=/) { log_warning("$file:$lineno: lone CWD= assignment is redundant in 15.0 template"); - } elsif(/^\s*?chown\s+[^#;]*\S+\.\S+/) { - log_warning("$file:$lineno: chown should use : instead of . for user:group separator"); + } elsif(/^\s*?chown\s/) { + # explanation in english: get rid of any comment portion of the command, + # then if we (a) have no : character, and (b) have what looks like + # user.group or $user.$group, complain. + # if (a) is true but (b) isn't, that probably means the user:group is + # given together in one variable, and we can't really check that. + # that, or there's no user/group at all (e.g. chown's --reference + # option). + my $chown = $_; + $chown =~ s/#.*//; + if(($chown !~ /:/) && + ($chown =~ / + (?:\b|\$) # word boundary or $ (in case it's a variable) + \w[\w\d]+ # assume user or var starts with letter or _, and >=2 chars long + \. # a literal dot + [\w\$][\w\d]+ # user or var again + /x)) + { + log_warning("$file:$lineno: chown should use : instead of . for user:group separator"); + } } if(/^[^#]*<documentation>/) { |