lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 31 Aug 2012 23:18:10 +1000
From:	Cruz Julian Bishop <cruzjbishop@...il.com>
To:	mcgrof@...il.com
Cc:	linux-kernel@...r.kernel.org,
	Cruz Julian Bishop <cruzjbishop@...il.com>
Subject: [PATCH 4/4] scripts/checkincludes.pl: Introduce 'quiet' mode

In order to make checkincludes more like checkpatch in terms
of functionality, I have introduced a 'quiet' mode.

This mode can be turned on with the -q argument.

When not in quiet mode, each file that does not have duplicated
includes will have a message generated. Not having this is
sometimes annoying when performing checks on a single file
or directory without problems - "No output, does that mean it's
all good or I wrote the wrong command?"

Signed-off-by: Cruz Julian Bishop <cruzjbishop@...il.com>
---
 scripts/checkincludes.pl |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl
index cde7ce1..bff7316 100755
--- a/scripts/checkincludes.pl
+++ b/scripts/checkincludes.pl
@@ -20,11 +20,14 @@ By default, we just warn of duplicates.
 
 Options:
   -r                Remove duplicated includes in place
+  -q                Do not show messages for files that do not
+                    have duplicated includes
 EOM
 	exit 1;
 }
 
 my $remove = 0;
+my $quiet = 0;
 
 if ($#ARGV < 0) {
 	usage();
@@ -35,6 +38,8 @@ my $argc = 0;
 foreach my $arg (@ARGV) {
 	if ($arg eq "-r") {
 		$remove = 1;
+	} elsif($arg eq "-q") {
+		$quiet = 1;
 	} else {
 		open(my $f, '<', $arg)
 		    or die "Cannot open $arg: $!.\n";
@@ -54,11 +59,16 @@ foreach my $arg (@ARGV) {
 		close($f);
 
 		if (!$remove) {
+			my $detected = 0;
 			foreach my $filename (keys %includedfiles) {
 				if ($includedfiles{$filename} > 1) {
+					$detected++;
 					print "$arg: $filename is included more than once.\n";
 				}
 			}
+			if (!$detected && !$quiet) {
+				print "$arg: No duplicated includes detected.\n";
+			}
 			next;
 		}
 
@@ -84,6 +94,8 @@ foreach my $arg (@ARGV) {
 		}
 		if ($dups > 0) {
 			print "$arg: removed $dups duplicate includes \n";
+		} elsif (!$quiet) {
+			print "$arg: no duplicated includes to remove \n";
 		}
 		close($f);
 	}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ