mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Joe Perches <joe@perches.com>
Cc: Sasha Levin <sashal@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] get_maintainer: lazy load JSON::PP only when --json is used
Date: Fri, 30 Oct 2026 22:44:03 +0100	[thread overview]
Message-ID: <auUPo66ISiR2gzmi@redhat.com> (raw)
In-Reply-To: <1ad2ae74e3257578cac561f19af63ccb94fce85a.camel@perches.com>

On 10/30, Joe Perches wrote:
>
> On Fri, 2026-10-30 at 17:17 +0100, Oleg Nesterov wrote:
> > On 10/30, Joe Perches wrote:
> > > > 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?

Hmm. I am not sure I understand you concerns. Let me add more details.
So, I think this patch makes no difference if JSON::PP is installed.
Do you agree?

Now lets see what happens on my machine where JSON::PP is NOT installed.
Without --json:

Before this patch:

	$ ./scripts/get_maintainer.pl ./scripts/get_maintainer.pl
	Can't locate JSON/PP.pm in @INC (you may need to install the JSON::PP 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 ./scripts/get_maintainer.pl line 24.
	BEGIN failed--compilation aborted at ./scripts/get_maintainer.pl line 24.

After:

	$ ./scripts/get_maintainer.pl ./scripts/get_maintainer.pl
	Joe Perches <joe@perches.com> (maintainer:GET_MAINTAINER SCRIPT)
	linux-kernel@vger.kernel.org (open list)

With --json:

Before this patch:

	$ ./scripts/get_maintainer.pl --json ./scripts/get_maintainer.pl
	Can't locate JSON/PP.pm in @INC (you may need to install the JSON::PP 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 ./scripts/get_maintainer.pl line 24.
	BEGIN failed--compilation aborted at ./scripts/get_maintainer.pl line 24.

After:

	$ ./scripts/get_maintainer.pl --json ./scripts/get_maintainer.pl
	Can't locate JSON/PP.pm in @INC (you may need to install the JSON::PP 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 ./scripts/get_maintainer.pl line 665.

Same failure. Sorry, I don't understand what is not clear for you :(

> 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.

And for what ???

If we want to "improve" the errmsg, we can use "eval { require JSON::PP; }; die ... if $@"
but this looks absolutely pointless to me.


Let me repeat. If JSON::PP is not installed, then get_maintainer.pl
with --json:

	fails the same way before or after this patch, I see nothing to improve.

without --json:

	fails before this patch, works after this patch


Sorry, I really can't understand your concerns.

Oleg.


  reply	other threads:[~2026-10-30 21:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30 15:43 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 21:44       ` Oleg Nesterov [this message]
2026-10-30 22:18         ` Sasha Levin
2026-10-30 22:19         ` Joe Perches
2026-10-30 22:55           ` Oleg Nesterov
2026-10-30 23:17             ` Joe Perches
2026-10-30 23:35               ` Oleg Nesterov
2026-10-30 16:29 ` [PATCH v2] " Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auUPo66ISiR2gzmi@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®