Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used

From: Joe Perches

Date: Fri Oct 30 2026 - 19:18:08 EST


On Fri, 2026-10-30 at 23:55 +0100, Oleg Nesterov wrote:
> On 10/30, Joe Perches wrote:
> > On Fri, 2026-10-30 at 22:44 +0100, Oleg Nesterov wrote:
>
> 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";
> > > > }
> > >
> > > But why? Why make get_maintainer.pl depend on yet another module?
> > > FYI, on my Fedora 44
> > >
> $ perl -we 'use Module::Load::Conditional qw(check_install);'
> Can't locate Module/Load/Conditional.pm in @INC (you may need to install the Module::Load::Conditional module) (@INC entries checked: /usr/local/lib64/perl5/5.42 /usr/local/share/perl5/5.42 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
> >
> > Module::Load is a core perl module since 5.10 and
> > I think you are using a broken version of a perl installation
> And how do you think it is broken? my laptop runs the fresh Fedora 44.

It doesn't include perl-core ;)

> I used ./scripts/get_maintainer.pl many years, almost every day, and I never
> needed to install the additional modules. Until ("get_maintainer: add --json
> output mode")

I think that was added in Linus' 7.2 in mid August and in -next since April

> > and I think you should:
> >
> > $ sudo dnf install perl-core
>
> Oh. I LOVE perl. Damn I still consider myself as a perl programmer ;)

:) I don't consider myself one...

> But why do you think I should install the additional modules (which I will
> never use) on my machine???

Just like you have to add development-tools to that install.

> Again, again, again. AFAICS, this patch makes no difference if JSON::PP
> is installed. Please correct me.

Why? You're not wrong.

> It just allows to use get_maintainer.pl without --json in the case when
> JSON::PP is NOT installed. This is the ONLY difference afaics.
> > > And for what ???
> > My idea is to make it more obvious _why_ something fails
> > and not like get_maintainer itself is broken.
> Good idea! But again, again, again, if JSON::PP is not installed, then the
> failure message is the same with or without my patch. Just get_maintainer.pl
> does NOT fail without --json.
>
> Although to be honest "Can't locate JSON/PP.pm ..." looks very clear to me,
> but you can make it more obvious with or without my patch.
> > > If we want to "improve" the errmsg, we can use "eval { require JSON::PP; }; die ... if $@"
> > > but this looks absolutely pointless to me.
> > We disagree. I prefer output errors to look less broken.
> less broken than what? see above.
>
> It's not that we disagree... Worse, we can't understand each other :(
> Perhaps is this my fault.

I don't disagree with the concept of the patch.

I think we understand each other fine, you just care less about the
output error message. What gets output now is from perl and I think
it looks less like get_maintainer is working properly.

cheers, Joe