* [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
@ 2026-10-30 15:43 Oleg Nesterov
2026-10-30 16:07 ` Joe Perches
2026-10-30 16:29 ` [PATCH v2] " Oleg Nesterov
0 siblings, 2 replies; 5+ messages in thread
From: Oleg Nesterov @ 2026-10-30 15:43 UTC (permalink / raw)
To: Joe Perches, Sasha Levin, Andrew Morton; +Cc: linux-kernel
After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
I can no longer use get_maintainer.pl; it fails at compile time if
JSON::PP is not installed even when --json is not requested.
This module is only needed with the --json option. Use "require" to
load this module dynamically inside the "if ($json)" block instead.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
scripts/get_maintainer.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 16b80a700d4a..8239c8ca0fce 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -21,7 +21,6 @@ use Cwd;
use File::Find;
use File::Spec::Functions;
use open qw(:std :encoding(UTF-8));
-use JSON::PP;
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
@@ -685,6 +684,7 @@ if ($json) {
$result{web} = \@web if ($web);
$result{bug} = \@bug if ($bug);
+ require JSON::PP;
my $json_encoder = JSON::PP->new->canonical->utf8;
print($json_encoder->encode(\%result) . "\n");
} else {
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
2026-10-30 15:43 [PATCH] get_maintainer: lazy load JSON::PP only when --json is used Oleg Nesterov
@ 2026-10-30 16:07 ` Joe Perches
2026-10-30 16:17 ` Oleg Nesterov
2026-10-30 16:29 ` [PATCH v2] " Oleg Nesterov
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2026-10-30 16:07 UTC (permalink / raw)
To: Oleg Nesterov, Sasha Levin, Andrew Morton; +Cc: linux-kernel
On Fri, 2026-10-30 at 16:43 +0100, Oleg Nesterov wrote:
> After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
> I can no longer use get_maintainer.pl; it fails at compile time
?
Just verifying that you mean when using perl directly and
not something like perlcc.
> if JSON::PP is not installed even when --json is not requested.
What version of perl are you using?
I believe JSON is bundled since perl 5.14
> This module is only needed with the --json option. Use "require" to
> load this module dynamically inside the "if ($json)" block instead.
The patch may be sensible but could fail the same way
if you used the --json option with your version.
> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
[]
> @@ -21,7 +21,6 @@ use Cwd;
> use File::Find;
> use File::Spec::Functions;
> use open qw(:std :encoding(UTF-8));
> -use JSON::PP;
>
> my $cur_path = fastgetcwd() . '/';
> my $lk_path = "./";
> @@ -685,6 +684,7 @@ if ($json) {
> $result{web} = \@web if ($web);
> $result{bug} = \@bug if ($bug);
>
> + require JSON::PP;
style nit:
I likely would have placed this require immediately after the
if ($json) {
> my $json_encoder = JSON::PP->new->canonical->utf8;
> print($json_encoder->encode(\%result) . "\n");
> } else {
>
> ```
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
2026-10-30 16:07 ` Joe Perches
@ 2026-10-30 16:17 ` Oleg Nesterov
2026-10-30 16:32 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Oleg Nesterov @ 2026-10-30 16:17 UTC (permalink / raw)
To: Joe Perches; +Cc: Sasha Levin, Andrew Morton, linux-kernel
On 10/30, Joe Perches wrote:
>
> On Fri, 2026-10-30 at 16:43 +0100, Oleg Nesterov wrote:
> > After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
> > I can no longer use get_maintainer.pl; it fails at compile time
>
> ?
>
> Just verifying that you mean when using perl directly and
> not something like perlcc.
Yes,
> > if JSON::PP is not installed even when --json is not requested.
>
> What version of perl are you using?
v5.42.3
> I believe JSON is bundled since perl 5.14
Well, JSON::PP is not installed on my Fedora release 44
> > This module is only needed with the --json option. Use "require" to
> > load this module dynamically inside the "if ($json)" block instead.
>
> The patch may be sensible but could fail the same way
> if you used the --json option with your version.
Of course, "./scripts/get_maintainer.pl --json ..." will still fail
the same way without JSON::PP. But with this patch get_maintainer.pl
works without the --json option.
> > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> []
> > @@ -21,7 +21,6 @@ use Cwd;
> > use File::Find;
> > use File::Spec::Functions;
> > use open qw(:std :encoding(UTF-8));
> > -use JSON::PP;
> >
> > my $cur_path = fastgetcwd() . '/';
> > my $lk_path = "./";
> > @@ -685,6 +684,7 @@ if ($json) {
> > $result{web} = \@web if ($web);
> > $result{bug} = \@bug if ($bug);
> >
> > + require JSON::PP;
>
> style nit:
> I likely would have placed this require immediately after the
> if ($json) {
I am fine either way... should I send V2 ?
Oleg.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] get_maintainer: lazy load JSON::PP only when --json is used
2026-10-30 15:43 [PATCH] get_maintainer: lazy load JSON::PP only when --json is used Oleg Nesterov
2026-10-30 16:07 ` Joe Perches
@ 2026-10-30 16:29 ` Oleg Nesterov
1 sibling, 0 replies; 5+ messages in thread
From: Oleg Nesterov @ 2026-10-30 16:29 UTC (permalink / raw)
To: Joe Perches, Sasha Levin, Andrew Morton; +Cc: linux-kernel
After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
I can no longer use get_maintainer.pl; it fails at compile time if
JSON::PP is not installed even when --json is not requested.
This module is only needed with the --json option. Use "require" to
load this module dynamically inside the "if ($json)" block instead.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
scripts/get_maintainer.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 16b80a700d4a..b31b4016802f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -21,7 +21,6 @@ use Cwd;
use File::Find;
use File::Spec::Functions;
use open qw(:std :encoding(UTF-8));
-use JSON::PP;
my $cur_path = fastgetcwd() . '/';
my $lk_path = "./";
@@ -663,6 +662,8 @@ my @maintainers = get_maintainers();
@bug = uniq(@bug) if ($bug);
if ($json) {
+ require JSON::PP;
+
my @json_maintainers;
for my $m (@maintainers) {
my ($addr, $role);
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
2026-10-30 16:17 ` Oleg Nesterov
@ 2026-10-30 16:32 ` Joe Perches
0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2026-10-30 16:32 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: Sasha Levin, Andrew Morton, linux-kernel
On Fri, 2026-10-30 at 17:17 +0100, Oleg Nesterov wrote:
> On 10/30, Joe Perches wrote:
> > On Fri, 2026-10-30 at 16:43 +0100, Oleg Nesterov wrote:
> After commit 09d8b39563e8 ("get_maintainer: add --json output mode"),
> > > I can no longer use get_maintainer.pl; it fails at compile time
> >
> > Just verifying that you mean when using perl directly and
> > not something like perlcc.
>
> Yes,
>
> > > if JSON::PP is not installed even when --json is not requested.
> > What version of perl are you using?
> v5.42.3
> > I believe JSON is bundled since perl 5.14
> Well, JSON::PP is not installed on my Fedora release 44
Hmm. Odd.
> > > This module is only needed with the --json option. Use "require" to
> > > load this module dynamically inside the "if ($json)" block instead.
> > The patch may be sensible but could fail the same way
> > if you used the --json option with your version.
>
> Of course, "./scripts/get_maintainer.pl --json ..." will still fail
> the same way without JSON::PP. But with this patch get_maintainer.pl
> works without the --json option.
What does that failure output?
> > > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> > []
> > > @@ -21,7 +21,6 @@ use Cwd;
> > > use File::Find;
> > > use File::Spec::Functions;
> > > use open qw(:std :encoding(UTF-8));
> > > -use JSON::PP;
> > >
> > > my $cur_path = fastgetcwd() . '/';
> > > my $lk_path = "./";
> > > @@ -685,6 +684,7 @@ if ($json) {
> > > $result{web} = \@web if ($web);
> > > $result{bug} = \@bug if ($bug);
> > >
> > > + require JSON::PP;
> > style nit:
> > I likely would have placed this require immediately after the
> > if ($json) {
>
> I am fine either way... should I send V2 ?
Dunno. Depending on the current failure output
maybe adding something like the below is better:
use Module::Load::Conditional qw(check_install);
if (!check_install(module => 'JSON:PP')) {
die "$P: --json not available - missing perl module JSON:PP\n";
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-30 16:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 15:43 [PATCH] get_maintainer: lazy load JSON::PP only when --json is used Oleg Nesterov
2026-10-30 16:07 ` Joe Perches
2026-10-30 16:17 ` Oleg Nesterov
2026-10-30 16:32 ` Joe Perches
2026-10-30 16:29 ` [PATCH v2] " Oleg Nesterov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®