[Rt-commit] rt branch, 4.4/work-with-both-gnupgs, created. rt-4.4.2-98-g23ed8b50a

Brian Duggan brian at bestpractical.com
Mon Mar 26 09:27:08 EDT 2018


The branch, 4.4/work-with-both-gnupgs has been created
        at  23ed8b50a8c55f24e91a442a3832569f72ec1534 (commit)

- Log -----------------------------------------------------------------
commit 9a785b6b166ba0415e268dc14c822f179e8d93d2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:37:46 2018 +0800

    fix the uninitialized warning in case @Order is empty
    
    It's rare but allowed that @Order is empty while @OrderBy is not

diff --git a/share/html/Elements/CollectionAsTable/Header b/share/html/Elements/CollectionAsTable/Header
index 4a2576858..e82e66a48 100644
--- a/share/html/Elements/CollectionAsTable/Header
+++ b/share/html/Elements/CollectionAsTable/Header
@@ -138,7 +138,7 @@ foreach my $col ( @Format ) {
         $attr = ProcessColumnMapValue( $attr, Arguments => [ $col->{'attribute'} ], Escape => 0 );
 
         my $new_order = 'ASC';
-        $new_order = $Order[0] eq 'ASC'? 'DESC': 'ASC'
+        $new_order = ($Order[0] // '') eq 'ASC'? 'DESC': 'ASC'
             if $OrderBy[0] && ($OrderBy[0] eq $attr or "$attr|$OrderBy[0]" =~ /^(Created|id)\|(Created|id)$/);
 
         $m->out(

commit 23ed8b50a8c55f24e91a442a3832569f72ec1534
Author: Brian C. Duggan <brian at bestpractical.com>
Date:   Thu Mar 15 16:03:38 2018 -0400

    Test modern gpg signing failure warnings
    
    The t/crypt/no-signer-address.t test tries to sign data when gpg has no
    signing key to use. Classic GPG only emitted one warning for this
    failure. Previously, this test checked only for that warning.
    
    Modern GPG emits all the warnings its documentation says it should
    emit. This change checks for those warnings, too.
    
    It's unclear why classic didn't emit these warnings when modern gpg
    does. The warnings are documented in the GnuPG source under doc/DETAILS
    in both classic and modern tags. Try 1.4.18 vs 2.1.18, the versions I
    tested with.

diff --git a/t/crypt/no-signer-address.t b/t/crypt/no-signer-address.t
index 31ba5ebc2..c90fb43c1 100644
--- a/t/crypt/no-signer-address.t
+++ b/t/crypt/no-signer-address.t
@@ -1,6 +1,8 @@
 use strict;
 use warnings;
 
+use GnuPG::Interface;
+
 use RT::Test::GnuPG
   tests         => undef,
   gnupg_options => {
@@ -9,6 +11,8 @@ use RT::Test::GnuPG
   }
 ;
 
+my $gnupg = GnuPG::Interface->new();
+
 my $queue;
 {
     $queue = RT::Test->load_or_create_queue(
@@ -35,8 +39,30 @@ my ($status, undef, $msg) = $ticket->Create(
 );
 ok( $status, "created ticket" ) or diag "error: $msg";
 
-is( scalar @warnings, 1, "Got a warning" );
-like( $warnings[0], qr{signing failed: secret key not available},
-    "Found warning of no secret key");
+# Classic GnuPG doesn't emit the latter two warnings. Modern GnuPG
+# does. Test with:
+# 
+# $ touch a-file
+# $ gpg --status-file gpg-status --default-key "bob at example.com" --sign a-file
+# $ cat gpg-status
+my @gnupg_versions = split /\./, $gnupg->version;
+if ($gnupg_versions[0] >= 2 && $gnupg_versions[1] >= 1) {
+    is( scalar @warnings, 3, "Got warnings" );
+
+    like( $warnings[0], qr{signing failed: No secret key},
+         "Found warning of no secret key");
+
+    like( $warnings[1], qr{INV_SGNR},
+         "Found warning of no usable senders");
+
+    like( $warnings[2], qr{FAILURE},
+         "Found warning of failure");
+}
+else {
+    is( scalar @warnings, 1, "Got a warning" );
+
+    like( $warnings[0], qr{signing failed: secret key not available},
+         "Found warning of no secret key");
+}
 
 done_testing;

-----------------------------------------------------------------------


More information about the rt-commit mailing list