Workflows Archive mirror
 help / color / mirror / Atom feed
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
To: workflows@vger.kernel.org, Joe Perches <joe@perches.com>
Cc: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Subject: [PATCH] get_maintainer: Survive querying missing files
Date: Fri,  9 Feb 2024 14:24:18 +0200	[thread overview]
Message-ID: <20240209122418.229144-1-Nikolai.Kondrashov@redhat.com> (raw)

Do not die, but only warn when scripts/get_maintainer.pl is asked to
retrieve information about a missing file.

This allows scripts/checkpatch.pl to query MAINTAINERS while processing
patches which are removing files.

For example take:

    commit ebb0130dad75 ("dt-bindings: mailbox: convert bcm2835-mbox bindings to YAML")

It removes a file (and recreates it in another format, but that's
besides the point) which belongs to four subsystems.

This will work OK:

    scripts/get_maintainer.pl \
        0001-dt-bindings-mailbox-convert-bcm2835-mbox-bindings-to.patch

But if we try to give the file being removed to get_maintainer.pl
directly:

    scripts/get_maintainer.pl \
        -f Documentation/devicetree/bindings/mailbox/brcm,bcm2835-mbox.txt

It will abort with the following message:

    scripts/get_maintainer.pl: file
    'Documentation/devicetree/bindings/mailbox/brcm,bcm2835-mbox.txt'
    not found

Even though the state of the source tree we're running this on is
*exactly* the same.

This commit downgrades that error to a warning.

Signed-off-by: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
---
 scripts/get_maintainer.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ee1aed7e090ca..35e888e3c1889 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -542,7 +542,11 @@ foreach my $file (@ARGV) {
 	if ((-d $file)) {
 	    $file =~ s@([^/])$@$1/@;
 	} elsif (!(-f $file)) {
-	    die "$P: file '${file}' not found\n";
+	    if ($from_filename) {
+		warn "$P: file '${file}' not found\n";
+	    } else {
+		die "$P: file '${file}' not found\n";
+	    }
 	}
     }
     if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) {
-- 
2.43.0


                 reply	other threads:[~2024-02-09 12:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240209122418.229144-1-Nikolai.Kondrashov@redhat.com \
    --to=nikolai.kondrashov@redhat.com \
    --cc=joe@perches.com \
    --cc=workflows@vger.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).