Date: Fri, 19 Jan 2001 02:50:04 -0500 (EST) From: dmaddox@sc.rr.com To: FreeBSD-gnats-submit@freebsd.org Subject: ports/24451: Minor improvement to portlint Message-ID: <200101190750.f0J7o4q03214@sc.rr.com>
next in thread | raw e-mail | index | archive | help
>Number: 24451 >Category: ports >Synopsis: Portlint doesn't catch some literal commands it should >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 19 00:00:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Donald J. Maddox >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD cae88-102-101.sc.rr.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Tue Jan 16 11:48:12 EST 2001 root@cae88-102-101.sc.rr.com:/usr/obj/usr/src/sys/RHIANNON i386 >Description: Portlint checks for use of literal commands, i.e. using 'cat $filename' instead of ${CAT} $filename; however, it misses some that it should catch. The patch below adds the ability to catch literal use of 'perl' or 'perl5', and additionally enables portlint to catch literal commands that start with '@' or '-' (currently, these are missed). >How-To-Repeat: >Fix: --- portlint.pl.original Fri Jan 19 02:18:18 2001 +++ portlint.pl Fri Jan 19 02:43:17 2001 @@ -747,7 +747,7 @@ print "OK: checking direct use of command names.\n" if ($verbose); foreach my $i (qw( awk basename cat chmod chown cp echo expr false gmake grep gzcat -ldconfig ln md5 mkdir mv patch rm rmdir sed sh touch tr which xmkmf +ldconfig ln md5 mkdir mv patch perl perl5 rm rmdir sed sh touch tr which xmkmf )) { $cmdnames{$i} = "\$\{\U$i\E\}"; } @@ -762,7 +762,7 @@ $j = $whole; $j =~ s/([ \t][\@-]?)(echo|\$[\{\(]ECHO[\}\)]|\$[\{\(]ECHO_MSG[\}\)])[ \t]+("(\\'|\\"|[^"])*"|'(\\'|\\"|[^'])*')[ \t]*[;\n]/$1$2;/; #" foreach my $i (keys %cmdnames) { - if ($j =~ /[ \t\/]$i[ \t\n;]/ + if ($j =~ /[ \t\/\@-]$i[ \t\n;]/ && $j !~ /\n[A-Z]+_TARGET[?+]?=[^\n]+$i/) { &perror("WARN: possible direct use of command \"$i\" ". "found. use $cmdnames{$i} instead."); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101190750.f0J7o4q03214>