[Rt-commit] rt branch, 4.0/raw-mode-on-scalar-ref, created. rt-4.0.8-281-gdbeb779
Alex Vandiver
alexmv at bestpractical.com
Wed Dec 19 23:17:11 EST 2012
The branch, 4.0/raw-mode-on-scalar-ref has been created
at dbeb7793199cd08a0b2b1cac7f1e459ad7f1133e (commit)
- Log -----------------------------------------------------------------
commit dbeb7793199cd08a0b2b1cac7f1e459ad7f1133e
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 784ba0e..2552994 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