[Rt-commit] rt branch, 3.8/gnupg-decrypt-verify-deadlock, updated. rt-3.8.15-4-gf476c00

Alex Vandiver alexmv at bestpractical.com
Mon Jan 7 19:16:53 EST 2013


The branch, 3.8/gnupg-decrypt-verify-deadlock has been updated
       via  f476c00c5cce6b141bf923541f545c4ac3a3a5d4 (commit)
      from  990db0edc4d4fae7eb09c854e854bd1a96882855 (commit)

Summary of changes:
 lib/RT/Crypt/GnuPG.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit f476c00c5cce6b141bf923541f545c4ac3a3a5d4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Dec 19 19:45:30 2012 -0500

    Work around a bug in perl < 5.13.10 with open($fh, ">:raw", \$string)
    
    Perl versions 5.13.9 and earlier interact poorly with :raw and the
    PerlIO layer which handles in-memory strings; this caused open($fh,
    ">:raw", \$string) to create a file on disk named "SCALAR(0xDEADBEEF)"
    and "<:raw" to read a file on disk named similarly on such versions of
    perl.
    
    Change the two callsites which open in :raw mode on an in-memory string
    to instead call binmode($fh, ":raw"), which works around this bug.

diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 045327c..21bdb70 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -910,13 +910,15 @@ sub FindProtectedParts {
                 local $@;
                 eval {
                     my $buf = '';
-                    open my $fh, '>:raw', \$buf
+                    open my $fh, '>', \$buf
                         or die "Couldn't open scalar for writing: $!";
+                    binmode $fh, ":raw";
                     $decoder->decode($io, $fh);
                     close $fh or die "Couldn't close scalar: $!";
 
-                    open $fh, '<:raw', \$buf
+                    open $fh, '<', \$buf
                         or die "Couldn't re-open scalar for reading: $!";
+                    binmode $fh, ":raw";
                     $io = $fh;
                     1;
                 } or do {

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


More information about the Rt-commit mailing list