aboutsummaryrefslogtreecommitdiff
path: root/sbolint
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-10-09 20:02:17 -0400
committerB. Watson <urchlay@slackware.uk>2024-10-09 20:02:17 -0400
commite26cd076e322b636438e0a9570434a8135af32a4 (patch)
tree77fbec0e159d20ef79d7e7a90ef33c2f6e97fa5a /sbolint
parent756d134a3b8c03881461c3f63ca36bb88370a954 (diff)
downloadsbo-maintainer-tools-e26cd076e322b636438e0a9570434a8135af32a4.tar.gz
sbolint: tighten up chown . checking (still not happy with it).
Diffstat (limited to 'sbolint')
-rwxr-xr-xsbolint22
1 files changed, 20 insertions, 2 deletions
diff --git a/sbolint b/sbolint
index 7d0ad72..9d71eb6 100755
--- a/sbolint
+++ b/sbolint
@@ -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>/) {