From unknown Mon Aug 18 09:00:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7243: [patch] making md5sum's warnings clearer Resent-From: "Benno Schulenberg" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 18 Oct 2010 21:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7243 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: 7243@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.12874368086098 (code B ref -1); Mon, 18 Oct 2010 21:21:01 +0000 Received: (at submit) by debbugs.gnu.org; 18 Oct 2010 21:20:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7x7n-0001aJ-UP for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:20:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7wlQ-0001Nr-98 for submit@debbugs.gnu.org; Mon, 18 Oct 2010 16:57:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7wp0-0000j2-TC for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:00:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7woy-0000hz-GQ for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:00:42 -0400 Received: from [140.186.70.92] (port=35783 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7wou-0006Mq-JB for bug-coreutils@gnu.org; Mon, 18 Oct 2010 17:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7wgF-0007oD-Vy for bug-coreutils@gnu.org; Mon, 18 Oct 2010 16:51:40 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:53313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7wgF-0007o3-Rt for bug-coreutils@gnu.org; Mon, 18 Oct 2010 16:51:39 -0400 Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id F1FAA32C for ; Mon, 18 Oct 2010 16:51:37 -0400 (EDT) Received: from web1.messagingengine.com ([10.202.2.211]) by compute2.internal (MEProxy); Mon, 18 Oct 2010 16:51:37 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:mime-version:content-transfer-encoding:content-type:subject:date; s=smtpout; bh=2tWE6060hLR2T9SeuueSyq2rTUc=; b=hLeYZeKqRaaI13/2dZqSd2Mf5KXv+inNNFK6hinhNbjxp7FWMz9JtX/thHEf/aOnD8U42SlmcBzUfLejr+seD7buManCNsDIhzpuARm2c5bURsmAckYQFPdirgrlJ43YmP7/C5BJA9KzbCfT2C2CVN8SuRqLswoeJHvo/9I/wZo= Received: by web1.messagingengine.com (Postfix, from userid 99) id D334A3C366D; Mon, 18 Oct 2010 16:51:37 -0400 (EDT) Message-Id: <1287435097.15521.1400708715@webmail.messagingengine.com> X-Sasl-Enc: Al8EaTPJEX31Qyctp9ArYa2ufVU7P9l4lZCAlJ/3VxFr 1287435097 From: "Benno Schulenberg" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1287435097155213" X-Mailer: MessagingEngine.com Webmail Interface Date: Mon, 18 Oct 2010 22:51:37 +0200 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.3 (-----) X-Mailman-Approved-At: Mon, 18 Oct 2010 17:20:05 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) This is a multi-part message in MIME format. --_----------=_1287435097155213 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii" Date: Mon, 18 Oct 2010 16:51:37 -0400 X-Mailer: MessagingEngine.com Webmail Interface Hi, Two years ago I complained about the untranslatability of the warnings that md5sum prints when it has encountered unexpected things: http://lists.gnu.org/archive/html/bug-coreutils/2008-09/msg00168.html Jim asked to come up with a change that doesn't remove information. I've finally gotten around to making this -- see the attached patch. In addition to read failures and checksum failures, md5sum now alerts the user to the number of misformatted checksum lines. It prints this line also when '--warn' is not given, because it is so important. Regards, Benno (Please CC, not subscribed.) -- http://www.fastmail.fm - Same, same, but different... --_----------=_1287435097155213 MIME-Version: 1.0 Content-Disposition: attachment; filename="0001-md5sum-print-a-summary-warning-for-improperly-format.patch" Content-Id: Content-Transfer-Encoding: base64 Content-Type: text/x-patch; name="0001-md5sum-print-a-summary-warning-for-improperly-format.patch" X-Mailer: MIME::Lite 3.021 (F2.76; T1.24; A2.03; B3.07_01; Q3.07) Date: Mon, 18 Oct 2010 16:51:37 -0400 RnJvbSBmYzU0NjBlZDA1NTYxYTk3NTQ3NTQ5OTNmN2FhZGQ1NDFlYjk4YzFj IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBCZW5ubyBTY2h1bGVu YmVyZyA8YmVuc2JlcmdAanVzdGVtY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9yZWFkX2ZhaWx1cmVzID0gMDsKQEAgLTQ4OSw2ICs0OTAsOCBAQCBk aWdlc3RfY2hlY2sgKGNvbnN0IGNoYXIgKmNoZWNrZmlsZV9uYW1lKQogICAg ICAgICAgICAgICYmICEgKGlzX3N0ZGluICYmIFNUUkVRIChmaWxlbmFtZSwg Ii0iKSkKICAgICAgICAgICAgICAmJiBoZXhfZGlnaXRzIChoZXhfZGlnZXN0 KSkpCiAgICAgICAgIHsKKyAgICAgICAgICArK25fbWlzZm9ybWF0dGVkX2xp bmVzOworCiAgICAgICAgICAgaWYgKHdhcm4pCiAgICAgICAgICAgICB7CiAg ICAgICAgICAgICAgIGVycm9yICgwLCAwLApAQCAtNTcxLDI3ICs1NzQsMjYg QEAgZGlnZXN0X2NoZWNrIChjb25zdCBjaGFyICpjaGVja2ZpbGVfbmFtZSkK ICAgICB7CiAgICAgICBpZiAoIXN0YXR1c19vbmx5KQogICAgICAgICB7Cisg ICAgICAgICAgaWYgKG5fbWlzZm9ybWF0dGVkX2xpbmVzICE9IDApCisgICAg ICAgICAgICBlcnJvciAoMCwgMCwKKyAgICAgICAgICAgICAgICAgICBuZ2V0 dGV4dCAoIldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaW5lIGlzIGltcHJvcGVy bHkgZm9ybWF0dGVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaW5lcyBhcmUgaW1wcm9wZXJseSBm b3JtYXR0ZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxl Y3RfcGx1cmFsIChuX21pc2Zvcm1hdHRlZF9saW5lcykpLAorICAgICAgICAg ICAgICAgICAgIG5fbWlzZm9ybWF0dGVkX2xpbmVzKTsKKwogICAgICAgICAg IGlmIChuX29wZW5fb3JfcmVhZF9mYWlsdXJlcyAhPSAwKQogICAgICAgICAg ICAgZXJyb3IgKDAsIDAsCi0gICAgICAgICAgICAgICAgICAgbmdldHRleHQg KCJXQVJOSU5HOiAlIiBQUkl1TUFYICIgb2YgJSIgUFJJdU1BWAotICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAiIGxpc3RlZCBmaWxlIGNvdWxkIG5v dCBiZSByZWFkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIldB Uk5JTkc6ICUiIFBSSXVNQVggIiBvZiAlIiBQUkl1TUFYCi0gICAgICAgICAg ICAgICAgICAgICAgICAgICAgICIgbGlzdGVkIGZpbGVzIGNvdWxkIG5vdCBi ZSByZWFkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0 X3BsdXJhbCAobl9wcm9wZXJseV9mb3JtYXR0ZWRfbGluZXMpKSwKLSAgICAg ICAgICAgICAgICAgICBuX29wZW5fb3JfcmVhZF9mYWlsdXJlcywgbl9wcm9w ZXJseV9mb3JtYXR0ZWRfbGluZXMpOworICAgICAgICAgICAgICAgICAgIG5n ZXR0ZXh0ICgiV0FSTklORzogJSIgUFJJdU1BWCAiIGxpc3RlZCBmaWxlIGNv dWxkIG5vdCBiZSByZWFkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaXN0ZWQgZmlsZXMgY291bGQg bm90IGJlIHJlYWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz ZWxlY3RfcGx1cmFsIChuX29wZW5fb3JfcmVhZF9mYWlsdXJlcykpLAorICAg ICAgICAgICAgICAgICAgIG5fb3Blbl9vcl9yZWFkX2ZhaWx1cmVzKTsKIAog ICAgICAgICAgIGlmIChuX21pc21hdGNoZWRfY2hlY2tzdW1zICE9IDApCi0g ICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIHVpbnRtYXhfdCBuX2NvbXB1 dGVkX2NoZWNrc3VtcyA9Ci0gICAgICAgICAgICAgICAgKG5fcHJvcGVybHlf Zm9ybWF0dGVkX2xpbmVzIC0gbl9vcGVuX29yX3JlYWRfZmFpbHVyZXMpOwot ICAgICAgICAgICAgICBlcnJvciAoMCwgMCwKLSAgICAgICAgICAgICAgICAg ICAgIG5nZXR0ZXh0ICgiV0FSTklORzogJSIgUFJJdU1BWCAiIG9mICUiIFBS SXVNQVgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGNvbXB1 dGVkIGNoZWNrc3VtIGRpZCBOT1QgbWF0Y2giLAotICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICJXQVJOSU5HOiAlIiBQUkl1TUFYICIgb2YgJSIg UFJJdU1BWAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgY29t cHV0ZWQgY2hlY2tzdW1zIGRpZCBOT1QgbWF0Y2giLAotICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNlbGVjdF9wbHVyYWwgKG5fY29tcHV0ZWRf Y2hlY2tzdW1zKSksCi0gICAgICAgICAgICAgICAgICAgICBuX21pc21hdGNo ZWRfY2hlY2tzdW1zLCBuX2NvbXB1dGVkX2NoZWNrc3Vtcyk7Ci0gICAgICAg ICAgICB9CisgICAgICAgICAgICBlcnJvciAoMCwgMCwKKyAgICAgICAgICAg ICAgICAgICBuZ2V0dGV4dCAoIldBUk5JTkc6ICUiIFBSSXVNQVggIiBjb21w dXRlZCBjaGVja3N1bSBkaWQgTk9UIG1hdGNoIiwKKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIldBUk5JTkc6ICUiIFBSSXVNQVggIiBjb21wdXRl ZCBjaGVja3N1bXMgZGlkIE5PVCBtYXRjaCIsCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHNlbGVjdF9wbHVyYWwgKG5fbWlzbWF0Y2hlZF9jaGVj a3N1bXMpKSwKKyAgICAgICAgICAgICAgICAgICBuX21pc21hdGNoZWRfY2hl Y2tzdW1zKTsKICAgICAgICAgfQogICAgIH0KIAotLSAKMS42LjMuMwoK --_----------=_1287435097155213-- From unknown Mon Aug 18 09:00:49 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7243: [patch] making md5sum's warnings clearer Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 19 Oct 2010 07:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7243 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: patch To: "Benno Schulenberg" Cc: 7243@debbugs.gnu.org Received: via spool by 7243-submit@debbugs.gnu.org id=B7243.128747362823623 (code B ref 7243); Tue, 19 Oct 2010 07:34:02 +0000 Received: (at 7243) by debbugs.gnu.org; 19 Oct 2010 07:33:48 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P86hg-00068y-CD for submit@debbugs.gnu.org; Tue, 19 Oct 2010 03:33:48 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P86hd-00068t-UY for 7243@debbugs.gnu.org; Tue, 19 Oct 2010 03:33:47 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 54E50D838; Tue, 19 Oct 2010 09:37:30 +0200 (CEST) From: Jim Meyering In-Reply-To: <1287435097.15521.1400708715@webmail.messagingengine.com> (Benno Schulenberg's message of "Mon, 18 Oct 2010 22:51:37 +0200") References: <1287435097.15521.1400708715@webmail.messagingengine.com> Date: Tue, 19 Oct 2010 09:37:30 +0200 Message-ID: <871v7md45h.fsf@meyering.net> Lines: 158 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.4 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Benno Schulenberg wrote: > Two years ago I complained about the untranslatability of the warnings > that md5sum prints when it has encountered unexpected things: > http://lists.gnu.org/archive/html/bug-coreutils/2008-09/msg00168.html > > Jim asked to come up with a change that doesn't remove information. > I've finally gotten around to making this -- see the attached patch. > In addition to read failures and checksum failures, md5sum now alerts > the user to the number of misformatted checksum lines. It prints this > line also when '--warn' is not given, because it is so important. Thanks for following up. I've applied your patch after adjusting the log and a failing test, then added two more tests to cover the new types of output lines. >From 407806b27f032b3bce828ee0a152b5f67e997e09 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 18 Oct 2010 22:35:39 +0200 Subject: [PATCH 1/2] md5sum: print a summary warning for improperly formatted lines And remove the now-superfluous totals from the other two warnings, so the plurals will also work in other languages than English. * src/md5sum.c (digest_check): Change as above. * tests/misc/md5sum (check-quiet2): Adjust accordingly. --- src/md5sum.c | 36 +++++++++++++++++++----------------- tests/misc/md5sum | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/md5sum.c b/src/md5sum.c index 10d4fa2..a660e3b 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -431,6 +431,7 @@ static bool digest_check (const char *checkfile_name) { FILE *checkfile_stream; + uintmax_t n_misformatted_lines = 0; uintmax_t n_properly_formatted_lines = 0; uintmax_t n_mismatched_checksums = 0; uintmax_t n_open_or_read_failures = 0; @@ -489,6 +490,8 @@ digest_check (const char *checkfile_name) && ! (is_stdin && STREQ (filename, "-")) && hex_digits (hex_digest))) { + ++n_misformatted_lines; + if (warn) { error (0, 0, @@ -571,27 +574,26 @@ digest_check (const char *checkfile_name) { if (!status_only) { + if (n_misformatted_lines != 0) + error (0, 0, + ngettext ("WARNING: %" PRIuMAX " line is improperly formatted", + "WARNING: %" PRIuMAX " lines are improperly formatted", + select_plural (n_misformatted_lines)), + n_misformatted_lines); + if (n_open_or_read_failures != 0) error (0, 0, - ngettext ("WARNING: %" PRIuMAX " of %" PRIuMAX - " listed file could not be read", - "WARNING: %" PRIuMAX " of %" PRIuMAX - " listed files could not be read", - select_plural (n_properly_formatted_lines)), - n_open_or_read_failures, n_properly_formatted_lines); + ngettext ("WARNING: %" PRIuMAX " listed file could not be read", + "WARNING: %" PRIuMAX " listed files could not be read", + select_plural (n_open_or_read_failures)), + n_open_or_read_failures); if (n_mismatched_checksums != 0) - { - uintmax_t n_computed_checksums = - (n_properly_formatted_lines - n_open_or_read_failures); - error (0, 0, - ngettext ("WARNING: %" PRIuMAX " of %" PRIuMAX - " computed checksum did NOT match", - "WARNING: %" PRIuMAX " of %" PRIuMAX - " computed checksums did NOT match", - select_plural (n_computed_checksums)), - n_mismatched_checksums, n_computed_checksums); - } + error (0, 0, + ngettext ("WARNING: %" PRIuMAX " computed checksum did NOT match", + "WARNING: %" PRIuMAX " computed checksums did NOT match", + select_plural (n_mismatched_checksums)), + n_mismatched_checksums); } } diff --git a/tests/misc/md5sum b/tests/misc/md5sum index d3c523e..92cc0fb 100755 --- a/tests/misc/md5sum +++ b/tests/misc/md5sum @@ -51,7 +51,7 @@ my @Tests = ['check-quiet2', '--check', '--quiet', {IN=>{'f.md5' => "$degenerate f\n"}}, {AUX=> {f=> 'foo'}}, {OUT=>"f: FAILED\n"}, - {ERR=>"md5sum: WARNING: 1 of 1 computed" + {ERR=>"md5sum: WARNING: 1 computed" . " checksum did NOT match\n"}, {EXIT=> 1}], # The sha1sum and md5sum drivers share a lot of code. -- 1.7.3.1.526.g2ee4 >From 10a0bdfa986dc77b9c5b7171b701e77d02756759 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 19 Oct 2010 09:19:59 +0200 Subject: [PATCH 2/2] tests: trigger and test for md5sum's new diagnostics * tests/misc/md5sum: Test for new diagnostics. --- tests/misc/md5sum | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/tests/misc/md5sum b/tests/misc/md5sum index 92cc0fb..819a819 100755 --- a/tests/misc/md5sum +++ b/tests/misc/md5sum @@ -54,6 +54,29 @@ my @Tests = {ERR=>"md5sum: WARNING: 1 computed" . " checksum did NOT match\n"}, {EXIT=> 1}], + # Exercise new-after-8.6, easier-to-translate diagnostics. + ['check-multifail', '--check', + {IN=>{'f.md5' => + "$degenerate f\n" + . "$degenerate f\n" + . "invalid\n" }}, + {AUX=> {f=> 'foo'}}, + {OUT=>"f: FAILED\nf: FAILED\n"}, + {ERR=>"md5sum: WARNING: 1 line is improperly formatted\n" + . "md5sum: WARNING: 2 computed checksums did NOT match\n"}, + {EXIT=> 1}], + # Similar to the above, but use --warn to evoke one more diagnostic. + ['check-multifail-warn', '--check', '--warn', + {IN=>{'f.md5' => + "$degenerate f\n" + . "$degenerate f\n" + . "invalid\n" }}, + {AUX=> {f=> 'foo'}}, + {OUT=>"f: FAILED\nf: FAILED\n"}, + {ERR=>"md5sum: f.md5: 3: improperly formatted MD5 checksum line\n" + . "md5sum: WARNING: 1 line is improperly formatted\n" + . "md5sum: WARNING: 2 computed checksums did NOT match\n"}, + {EXIT=> 1}], # The sha1sum and md5sum drivers share a lot of code. # Ensure that md5sum does *not* share the part that makes # sha1sum accept BSD format. -- 1.7.3.1.526.g2ee4 From unknown Mon Aug 18 09:00:49 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Benno Schulenberg" Subject: bug#7243: closed (Re: bug#7243: [patch] making md5sum's warnings clearer) Message-ID: References: <87aama6kyo.fsf@meyering.net> <1287435097.15521.1400708715@webmail.messagingengine.com> X-Gnu-PR-Message: they-closed 7243 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: patch Reply-To: 7243@debbugs.gnu.org Date: Tue, 19 Oct 2010 19:25:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1287516302-16241-1" This is a multi-part message in MIME format... ------------=_1287516302-16241-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7243: [patch] making md5sum's warnings clearer which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7243@debbugs.gnu.org. --=20 7243: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7243 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1287516302-16241-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7243-done) by debbugs.gnu.org; 19 Oct 2010 19:24:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P8Hnj-0004Dk-H3 for submit@debbugs.gnu.org; Tue, 19 Oct 2010 15:24:47 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P8Hni-0004Df-1O for 7243-done@debbugs.gnu.org; Tue, 19 Oct 2010 15:24:47 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 5A7F2D838; Tue, 19 Oct 2010 21:28:31 +0200 (CEST) From: Jim Meyering To: "Benno Schulenberg" Subject: Re: bug#7243: [patch] making md5sum's warnings clearer In-Reply-To: <871v7md45h.fsf@meyering.net> (Jim Meyering's message of "Tue, 19 Oct 2010 09:37:30 +0200") References: <1287435097.15521.1400708715@webmail.messagingengine.com> <871v7md45h.fsf@meyering.net> Date: Tue, 19 Oct 2010 21:28:31 +0200 Message-ID: <87aama6kyo.fsf@meyering.net> Lines: 25 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: 7243-done Cc: 7243-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Jim Meyering wrote: > Benno Schulenberg wrote: >> Two years ago I complained about the untranslatability of the warnings >> that md5sum prints when it has encountered unexpected things: >> http://lists.gnu.org/archive/html/bug-coreutils/2008-09/msg00168.html >> >> Jim asked to come up with a change that doesn't remove information. >> I've finally gotten around to making this -- see the attached patch. >> In addition to read failures and checksum failures, md5sum now alerts >> the user to the number of misformatted checksum lines. It prints this >> line also when '--warn' is not given, because it is so important. > > Thanks for following up. > I've applied your patch after adjusting the log and a failing test, > then added two more tests to cover the new types of output lines. > > Subject: [PATCH 1/2] md5sum: print a summary warning for improperly formatted lines > > And remove the now-superfluous totals from the other two warnings, > so the plurals will also work in other languages than English. > > * src/md5sum.c (digest_check): Change as above. > * tests/misc/md5sum (check-quiet2): Adjust accordingly. FYI, I'm marking this as closed. ------------=_1287516302-16241-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Oct 2010 21:20:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7x7n-0001aJ-UP for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:20:08 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P7wlQ-0001Nr-98 for submit@debbugs.gnu.org; Mon, 18 Oct 2010 16:57:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7wp0-0000j2-TC for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:00:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:54378) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7woy-0000hz-GQ for submit@debbugs.gnu.org; Mon, 18 Oct 2010 17:00:42 -0400 Received: from [140.186.70.92] (port=35783 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P7wou-0006Mq-JB for bug-coreutils@gnu.org; Mon, 18 Oct 2010 17:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P7wgF-0007oD-Vy for bug-coreutils@gnu.org; Mon, 18 Oct 2010 16:51:40 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:53313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P7wgF-0007o3-Rt for bug-coreutils@gnu.org; Mon, 18 Oct 2010 16:51:39 -0400 Received: from compute2.internal (compute2.nyi.mail.srv.osa [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id F1FAA32C for ; Mon, 18 Oct 2010 16:51:37 -0400 (EDT) Received: from web1.messagingengine.com ([10.202.2.211]) by compute2.internal (MEProxy); Mon, 18 Oct 2010 16:51:37 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:from:to:mime-version:content-transfer-encoding:content-type:subject:date; s=smtpout; bh=2tWE6060hLR2T9SeuueSyq2rTUc=; b=hLeYZeKqRaaI13/2dZqSd2Mf5KXv+inNNFK6hinhNbjxp7FWMz9JtX/thHEf/aOnD8U42SlmcBzUfLejr+seD7buManCNsDIhzpuARm2c5bURsmAckYQFPdirgrlJ43YmP7/C5BJA9KzbCfT2C2CVN8SuRqLswoeJHvo/9I/wZo= Received: by web1.messagingengine.com (Postfix, from userid 99) id D334A3C366D; Mon, 18 Oct 2010 16:51:37 -0400 (EDT) Message-Id: <1287435097.15521.1400708715@webmail.messagingengine.com> X-Sasl-Enc: Al8EaTPJEX31Qyctp9ArYa2ufVU7P9l4lZCAlJ/3VxFr 1287435097 From: "Benno Schulenberg" To: bug-coreutils@gnu.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1287435097155213" X-Mailer: MessagingEngine.com Webmail Interface Subject: [patch] making md5sum's warnings clearer Date: Mon, 18 Oct 2010 22:51:37 +0200 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 18 Oct 2010 17:20:05 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) This is a multi-part message in MIME format. --_----------=_1287435097155213 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii" Date: Mon, 18 Oct 2010 16:51:37 -0400 X-Mailer: MessagingEngine.com Webmail Interface Hi, Two years ago I complained about the untranslatability of the warnings that md5sum prints when it has encountered unexpected things: http://lists.gnu.org/archive/html/bug-coreutils/2008-09/msg00168.html Jim asked to come up with a change that doesn't remove information. I've finally gotten around to making this -- see the attached patch. In addition to read failures and checksum failures, md5sum now alerts the user to the number of misformatted checksum lines. It prints this line also when '--warn' is not given, because it is so important. Regards, Benno (Please CC, not subscribed.) -- http://www.fastmail.fm - Same, same, but different... --_----------=_1287435097155213 MIME-Version: 1.0 Content-Disposition: attachment; filename="0001-md5sum-print-a-summary-warning-for-improperly-format.patch" Content-Id: Content-Transfer-Encoding: base64 Content-Type: text/x-patch; name="0001-md5sum-print-a-summary-warning-for-improperly-format.patch" X-Mailer: MIME::Lite 3.021 (F2.76; T1.24; A2.03; B3.07_01; Q3.07) Date: Mon, 18 Oct 2010 16:51:37 -0400 RnJvbSBmYzU0NjBlZ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HVpbnRtYXhfdCBu X3Byb3Blcmx5X2Zvcm1hdHRlZF9saW5lcyA9IDA7CiAgIHVpbnRtYXhfdCBu X21pc21hdGNoZWRfY2hlY2tzdW1zID0gMDsKICAgdWludG1heF90IG5fb3Bl bl9vcl9yZWFkX2ZhaWx1cmVzID0gMDsKQEAgLTQ4OSw2ICs0OTAsOCBAQCBk aWdlc3RfY2hlY2sgKGNvbnN0IGNoYXIgKmNoZWNrZmlsZV9uYW1lKQogICAg ICAgICAgICAgICYmICEgKGlzX3N0ZGluICYmIFNUUkVRIChmaWxlbmFtZSwg Ii0iKSkKICAgICAgICAgICAgICAmJiBoZXhfZGlnaXRzIChoZXhfZGlnZXN0 KSkpCiAgICAgICAgIHsKKyAgICAgICAgICArK25fbWlzZm9ybWF0dGVkX2xp bmVzOworCiAgICAgICAgICAgaWYgKHdhcm4pCiAgICAgICAgICAgICB7CiAg ICAgICAgICAgICAgIGVycm9yICgwLCAwLApAQCAtNTcxLDI3ICs1NzQsMjYg QEAgZGlnZXN0X2NoZWNrIChjb25zdCBjaGFyICpjaGVja2ZpbGVfbmFtZSkK ICAgICB7CiAgICAgICBpZiAoIXN0YXR1c19vbmx5KQogICAgICAgICB7Cisg ICAgICAgICAgaWYgKG5fbWlzZm9ybWF0dGVkX2xpbmVzICE9IDApCisgICAg ICAgICAgICBlcnJvciAoMCwgMCwKKyAgICAgICAgICAgICAgICAgICBuZ2V0 dGV4dCAoIldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaW5lIGlzIGltcHJvcGVy bHkgZm9ybWF0dGVkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaW5lcyBhcmUgaW1wcm9wZXJseSBm b3JtYXR0ZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZWxl Y3RfcGx1cmFsIChuX21pc2Zvcm1hdHRlZF9saW5lcykpLAorICAgICAgICAg ICAgICAgICAgIG5fbWlzZm9ybWF0dGVkX2xpbmVzKTsKKwogICAgICAgICAg IGlmIChuX29wZW5fb3JfcmVhZF9mYWlsdXJlcyAhPSAwKQogICAgICAgICAg ICAgZXJyb3IgKDAsIDAsCi0gICAgICAgICAgICAgICAgICAgbmdldHRleHQg KCJXQVJOSU5HOiAlIiBQUkl1TUFYICIgb2YgJSIgUFJJdU1BWAotICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAiIGxpc3RlZCBmaWxlIGNvdWxkIG5v dCBiZSByZWFkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIldB Uk5JTkc6ICUiIFBSSXVNQVggIiBvZiAlIiBQUkl1TUFYCi0gICAgICAgICAg ICAgICAgICAgICAgICAgICAgICIgbGlzdGVkIGZpbGVzIGNvdWxkIG5vdCBi ZSByZWFkIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0 X3BsdXJhbCAobl9wcm9wZXJseV9mb3JtYXR0ZWRfbGluZXMpKSwKLSAgICAg ICAgICAgICAgICAgICBuX29wZW5fb3JfcmVhZF9mYWlsdXJlcywgbl9wcm9w ZXJseV9mb3JtYXR0ZWRfbGluZXMpOworICAgICAgICAgICAgICAgICAgIG5n ZXR0ZXh0ICgiV0FSTklORzogJSIgUFJJdU1BWCAiIGxpc3RlZCBmaWxlIGNv dWxkIG5vdCBiZSByZWFkIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIldBUk5JTkc6ICUiIFBSSXVNQVggIiBsaXN0ZWQgZmlsZXMgY291bGQg bm90IGJlIHJlYWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBz ZWxlY3RfcGx1cmFsIChuX29wZW5fb3JfcmVhZF9mYWlsdXJlcykpLAorICAg ICAgICAgICAgICAgICAgIG5fb3Blbl9vcl9yZWFkX2ZhaWx1cmVzKTsKIAog ICAgICAgICAgIGlmIChuX21pc21hdGNoZWRfY2hlY2tzdW1zICE9IDApCi0g ICAgICAgICAgICB7Ci0gICAgICAgICAgICAgIHVpbnRtYXhfdCBuX2NvbXB1 dGVkX2NoZWNrc3VtcyA9Ci0gICAgICAgICAgICAgICAgKG5fcHJvcGVybHlf Zm9ybWF0dGVkX2xpbmVzIC0gbl9vcGVuX29yX3JlYWRfZmFpbHVyZXMpOwot ICAgICAgICAgICAgICBlcnJvciAoMCwgMCwKLSAgICAgICAgICAgICAgICAg ICAgIG5nZXR0ZXh0ICgiV0FSTklORzogJSIgUFJJdU1BWCAiIG9mICUiIFBS SXVNQVgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGNvbXB1 dGVkIGNoZWNrc3VtIGRpZCBOT1QgbWF0Y2giLAotICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICJXQVJOSU5HOiAlIiBQUkl1TUFYICIgb2YgJSIg UFJJdU1BWAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgY29t cHV0ZWQgY2hlY2tzdW1zIGRpZCBOT1QgbWF0Y2giLAotICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHNlbGVjdF9wbHVyYWwgKG5fY29tcHV0ZWRf Y2hlY2tzdW1zKSksCi0gICAgICAgICAgICAgICAgICAgICBuX21pc21hdGNo ZWRfY2hlY2tzdW1zLCBuX2NvbXB1dGVkX2NoZWNrc3Vtcyk7Ci0gICAgICAg ICAgICB9CisgICAgICAgICAgICBlcnJvciAoMCwgMCwKKyAgICAgICAgICAg ICAgICAgICBuZ2V0dGV4dCAoIldBUk5JTkc6ICUiIFBSSXVNQVggIiBjb21w dXRlZCBjaGVja3N1bSBkaWQgTk9UIG1hdGNoIiwKKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIldBUk5JTkc6ICUiIFBSSXVNQVggIiBjb21wdXRl ZCBjaGVja3N1bXMgZGlkIE5PVCBtYXRjaCIsCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHNlbGVjdF9wbHVyYWwgKG5fbWlzbWF0Y2hlZF9jaGVj a3N1bXMpKSwKKyAgICAgICAgICAgICAgICAgICBuX21pc21hdGNoZWRfY2hl Y2tzdW1zKTsKICAgICAgICAgfQogICAgIH0KIAotLSAKMS42LjMuMwoK --_----------=_1287435097155213-- ------------=_1287516302-16241-1--