Skip to contentSkip to conversation

checkpatch: do not exit in main process subroutine

PATCH In review zhangwei(Jovi) 2 participants 4 messages Mar 28, 2013 – Apr 1, 2013 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: do not exit in main process subroutine

Currently checkpatch program exit when process empty file, This will cause issue when @ARGV include many files ready to check.

For example, there may have Module.symvers empty file in kernel directory.

[root@jovi ~]# scripts/checkpatch.pl -f kernel/*

then many file "after" empty file will not be check by script. so disallow exit in main process subroutine.

---
 scripts/checkpatch.pl |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index b28cc38..6924733 100755
@@ -3634,19 +3634,19 @@ sub process {
 	# If we have no input at all, then there is nothing to report on
 	# so just keep quiet.
 	if ($#rawlines == -1) {
-		exit(0);
+		return $clean;
 	}
 
 	# In mailback mode only produce a report in the negative, for
 	# things that appear to be patches.
 	if ($mailback && ($clean == 1 || !$is_patch)) {
-		exit(0);
+		return $clean;
 	}
 
 	# This is not a patch, and we are are in 'no-patch' mode so
 	# just keep quiet.
 	if (!$chk_patch && !$is_patch) {
-		exit(0);
+		return $clean;
 	}
 
 	if (!$is_patch) {
Signature · 1 line
1.7.9.7
#1 lore raw
Quoted 11 lines · zhangwei(Jovi)

Currently checkpatch program exit when process empty file, This will cause issue when @ARGV include many files ready to check.

For example, there may have Module.symvers empty file in kernel directory.

[root@jovi ~]# scripts/checkpatch.pl -f kernel/*

then many file "after" empty file will not be check by script. so disallow exit in main process subroutine.

Joe, Ping?

Quoted 32 lines
---
 scripts/checkpatch.pl |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index b28cc38..6924733 100755
@@ -3634,19 +3634,19 @@ sub process {
 	# If we have no input at all, then there is nothing to report on
 	# so just keep quiet.
 	if ($#rawlines == -1) {
-		exit(0);
+		return $clean;
 	}
 
 	# In mailback mode only produce a report in the negative, for
 	# things that appear to be patches.
 	if ($mailback && ($clean == 1 || !$is_patch)) {
-		exit(0);
+		return $clean;
 	}
 
 	# This is not a patch, and we are are in 'no-patch' mode so
 	# just keep quiet.
 	if (!$chk_patch && !$is_patch) {
-		exit(0);
+		return $clean;
 	}
 
 	if (!$is_patch) {
maintainer
#2 lore raw
Quoted 6 lines · zhangwei(Jovi)
Quoted 5 lines · zhangwei(Jovi)

Currently checkpatch program exit when process empty file, This will cause issue when @ARGV include many files ready to check.

For example, there may have Module.symvers empty file in kernel directory.

Quoted 7 lines
Quoted 6 lines

[root@jovi ~]# scripts/checkpatch.pl -f kernel/*

then many file "after" empty file will not be check by script. so disallow exit in main process subroutine.

Joe, Ping?

Off on a holiday. Will check later.

maintainer
#3 lore raw
In reply to zhangwei(Jovi)
Quoted 3 lines · zhangwei(Jovi)
Quoted 2 lines · zhangwei(Jovi)

Currently checkpatch program exit when process empty file, This will cause issue when @ARGV include many files ready to check.

[]

Quoted 8 lines

scripts/checkpatch.pl sub process { · line 3638

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -3634,19 +3634,19 @@ sub process {
 	# If we have no input at all, then there is nothing to report on
 	# so just keep quiet.
 	if ($#rawlines == -1) {
-		exit(0);
+		return $clean;
 	}

I think instead this should be something like adding

	if (!is_patch && $#rawlines == -1) {
		return $clean;
	}

though maybe expecting checkpatch to avoid empty files when fed a directory list is unrealistic.