[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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)
>From e61db1c02e8b54097e97ac0b9d7269bc6b7dcea3 Mon Sep 17 00:00:00 2001
From: Rafael Laboissiere <rafael@laboissiere.net>
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 =
 		      'control@bugs.something 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,
    'control@bugs.something'. "limit message failed with 1 error");
 
 send_message(to => 'control@bugs.something',
@@ -134,7 +134,7 @@ $SD_SIZE =
 		      'control@bugs.something 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,
    'control@bugs.something'. "limit message failed with 1 error");
 
 send_message(to => 'control@bugs.something',
-- 
2.4.0


Reply to: