linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: joe@perches.com
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] get_maintainer: Append parenthesis back to trimmed subsystem name
Date: Thu,  5 Aug 2021 00:09:48 +0800	[thread overview]
Message-ID: <20210804160949.592227-1-kai.heng.feng@canonical.com> (raw)

When a closing parenthesis gets trimmed, there can be unmatched
parenthesis in the subsystem name. This doesn't play well with
git-send-email:
(cc-cmd) Adding cc: intel-gfx@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...) from: 'scripts/get_maintainer.pl'
Unmatched () '(open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...)' '' at /usr/lib/git-core/git-send-email line 554.
error: unable to extract a valid address from: intel-gfx@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...)

So append parenthesis back if it was trimmed to make git-send-email
work again:
(cc-cmd) Adding cc: intel-gfx@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Mooresto...)) from: 'scripts/get_maintainer.pl'

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 scripts/get_maintainer.pl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 2075db0c08b8e..5ebe6dfe250c9 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -1252,9 +1252,10 @@ sub get_subsystem_name {
 
     my $subsystem = $typevalue[$start];
     if ($output_section_maxlen && length($subsystem) > $output_section_maxlen) {
-	$subsystem = substr($subsystem, 0, $output_section_maxlen - 3);
+	my $parenthesis = substr($subsystem, -1) eq ")";
+	$subsystem = substr($subsystem, 0, $output_section_maxlen - ($parenthesis ? 4 : 3));
 	$subsystem =~ s/\s*$//;
-	$subsystem = $subsystem . "...";
+	$subsystem = $subsystem . "..." . ($parenthesis ? ")" : "");
     }
     return $subsystem;
 }
-- 
2.31.1


             reply	other threads:[~2021-08-04 16:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 16:09 Kai-Heng Feng [this message]
2021-08-04 16:22 ` [PATCH] get_maintainer: Append parenthesis back to trimmed subsystem name Joe Perches
2021-08-05  6:17   ` Kai-Heng Feng
2021-08-05  6:33     ` Joe Perches
2021-08-05  6:44       ` Kai-Heng Feng

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=20210804160949.592227-1-kai.heng.feng@canonical.com \
    --to=kai.heng.feng@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@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 NNTP newsgroup(s).