The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RESEND 1/1] checkpatch: Skip CamelCase cache for --no-tree without root
@ 2026-08-10 16:11 Petr Vorel
  2026-08-10 21:44 ` Ricardo B. Marlière (SUSE)
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2026-08-10 16:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Petr Vorel, Andy Whitcroft, Joe Perches, Dwaipayan Ray,
	Lukas Bulwahn, Cryolitia PukNgae

Running outside tree (--no-tree) without git root (--root DIR) is not
doable because we have no include/ directory which could be cached. But
3445686af721 expected that we are always in Linux tree (w/a git).
But --no-tree does not require --root. Therefore skip whole caching in
that case.

This fixes perl and find errors when running checkpatch.pl *with*
--no-tree --strict and *without* --root:

    No structs that should be const will be found - file 'scripts/const_structs.checkpatch': No such file or directory
    Use of uninitialized value $root in concatenation (.) or string at scripts/checkpatch.pl line 1213.
    find: ‘/include’: No such file or directory

Fixes: 3445686af721 ("checkpatch: ignore existing CamelCase uses from include/...")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: I found that running checkpatch.pl on projects which vendored
checkpatch.pl (e.g. LTP or u-boot).

 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4f7325fd5825..9ce1113a64de 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1206,6 +1206,8 @@ sub seed_camelcase_includes {
 		my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
 		chomp $git_last_include_commit;
 		$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
+	} elsif (not defined $root) {
+		return;
 	} else {
 		my $last_mod_date = 0;
 		$files = `find $root/include -name "*.h"`;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND 1/1] checkpatch: Skip CamelCase cache for --no-tree without root
  2026-08-10 16:11 [PATCH RESEND 1/1] checkpatch: Skip CamelCase cache for --no-tree without root Petr Vorel
@ 2026-08-10 21:44 ` Ricardo B. Marlière (SUSE)
  0 siblings, 0 replies; 2+ messages in thread
From: Ricardo B. Marlière (SUSE) @ 2026-08-10 21:44 UTC (permalink / raw)
  To: Petr Vorel, linux-kernel
  Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
	Cryolitia PukNgae

On Mon Aug 10, 2026 at 1:11 PM -03, Petr Vorel wrote:
> Running outside tree (--no-tree) without git root (--root DIR) is not
> doable because we have no include/ directory which could be cached. But
> 3445686af721 expected that we are always in Linux tree (w/a git).
> But --no-tree does not require --root. Therefore skip whole caching in
> that case.
>
> This fixes perl and find errors when running checkpatch.pl *with*
> --no-tree --strict and *without* --root:
>
>     No structs that should be const will be found - file 'scripts/const_structs.checkpatch': No such file or directory
>     Use of uninitialized value $root in concatenation (.) or string at scripts/checkpatch.pl line 1213.
>     find: ‘/include’: No such file or directory
>
> Fixes: 3445686af721 ("checkpatch: ignore existing CamelCase uses from include/...")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: I found that running checkpatch.pl on projects which vendored
> checkpatch.pl (e.g. LTP or u-boot).
>
>  scripts/checkpatch.pl | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4f7325fd5825..9ce1113a64de 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1206,6 +1206,8 @@ sub seed_camelcase_includes {
>  		my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
>  		chomp $git_last_include_commit;
>  		$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
> +	} elsif (not defined $root) {
> +		return;

Reviewed-by: Ricardo B. Marlière (SUSE) <ricardo@marliere.net>

>  	} else {
>  		my $last_mod_date = 0;
>  		$files = `find $root/include -name "*.h"`;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-10 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 16:11 [PATCH RESEND 1/1] checkpatch: Skip CamelCase cache for --no-tree without root Petr Vorel
2026-08-10 21:44 ` Ricardo B. Marlière (SUSE)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox