linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] get_maintainer: Append parenthesis back to trimmed subsystem name
@ 2021-08-04 16:09 Kai-Heng Feng
  2021-08-04 16:22 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2021-08-04 16:09 UTC (permalink / raw)
  To: joe; +Cc: Kai-Heng Feng, open list

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-05  6:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 16:09 [PATCH] get_maintainer: Append parenthesis back to trimmed subsystem name Kai-Heng Feng
2021-08-04 16:22 ` 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

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