Bug#790716: debbugs: Fix plural/singular agreement in error messages

Rafael Laboissiere <[email protected]>
Newsgroups gmane.linux.debian.devel.debbugs
Organization Private email
Message-ID <20150701060141.GA12851__43148.9809685901$1435730617$gmane$org@laboissiere.net>
Package: debbugs
Version: 2.4.1.1
Severity: minor
Tags: patch

This is really a minor problem, but some error messages from debbugs 
lack plural/singular agreement.  With the patch attached to this bug 
report, debbugs will now say "with 1 error" instead of "with 1 errors". 
This patch applies against the sources in the Git repository for debbugs.

Best,

Rafael Laboissière


-- System Information: 
Debian Release: 8.0 
  APT prefers unstable 
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') 
Architecture: i386 (i686)

Kernel: Linux 3.18.0-trunk-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
0001-Plural-singular-agreement-in-error-message.patch (text/x-diff, 2.8 KB)
>From e61db1c02e8b54097e97ac0b9d7269bc6b7dcea3 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <[email protected]>
Date: Tue, 30 Jun 2015 23:54:15 +0200
Subject: [PATCH] Plural/singular agreement in error message

Make the error text message correctly respect the singular/plural
agreement with the number of errors.  We have now "with 1 error"
instead of "with 1 errors".

Also, change the 07_control_limit unit test accordingly.
---
 scripts/process      | 2 +-
 scripts/service      | 2 +-
 t/07_control_limit.t | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/process b/scripts/process
index bceb69c..4c38000 100755
--- a/scripts/process
+++ b/scripts/process
@@ -1070,7 +1070,7 @@ if (@control_bits) {
 					address_only => 1,
 					cc => 1,
 				       );
-    my $error_text = $errors > 0 ? " (with $errors errors)":'';
+    my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : "";
     my $reply =
 	create_mime_message(['X-Loop'      => $gMaintainerEmail,
 			     From          => "$gMaintainerEmail ($gProject $gBug Tracking System)",
diff --git a/scripts/service b/scripts/service
index 9debab2..10fbbc0 100755
--- a/scripts/service
+++ b/scripts/service
@@ -509,7 +509,7 @@ if (!defined $header{'subject'} || $header{'subject'} eq "") {
 }
 
 # Error text here advertises how many errors there were
-my $error_text = $errors > 0 ? " (with $errors errors)":'';
+my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : "";
 
 my @common_headers;
 push @common_headers, 'X-Loop',$gMaintainerEmail;
diff --git a/t/07_control_limit.t b/t/07_control_limit.t
index f4f600b..02cfc37 100644
--- a/t/07_control_limit.t
+++ b/t/07_control_limit.t
@@ -78,7 +78,7 @@ $SD_SIZE =
 		      '[email protected] messages appear to have been sent out properly');
 
 # make sure this fails
-ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0,
+ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0,
    '[email protected]'. "limit message failed with 1 error");
 
 send_message(to => '[email protected]',
@@ -134,7 +134,7 @@ $SD_SIZE =
 		      '[email protected] messages appear to have been sent out properly');
 
 # make sure this fails
-ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 errors): Munging a bug with limit_package_bar")) == 0,
+ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed (with 1 error): Munging a bug with limit_package_bar")) == 0,
    '[email protected]'. "limit message failed with 1 error");
 
 send_message(to => '[email protected]',
-- 
2.4.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.