Skip Menu |

This queue is for tickets about the File-KeePass CPAN distribution.

Report information
The Basics
Id: 67534
Status: resolved
Priority: 0/
Queue: File-KeePass

People
Owner: Nobody in particular
Requestors: yath [...] yath.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: No binmode on open set => fails on Win32
Date: Sun, 17 Apr 2011 17:55:24 +0200
To: bug-File-KeePass [...] rt.cpan.org
From: Sebastian Schmidt <yath [...] yath.de>
Hi, File::KeePass does not set the binmode on the opened file handles; this causes saves to fail because of Windows text translation. Sebastian Patch: diff -ur File-KeePass-0.03.old/lib/File/KeePass.pm File-KeePass-0.03/lib/File/KeePass.pm --- File-KeePass-0.03.old/lib/File/KeePass.pm 2011-04-17 17:51:37.000000000 +0200 +++ File-KeePass-0.03/lib/File/KeePass.pm 2011-04-17 17:54:38.000000000 +0200 @@ -44,6 +44,7 @@ my $pass = shift || croak "Missing pass\n"; open(my $fh, '<', $file) || croak "Couldn't open $file: $!\n"; + binmode($fh) || croak "Unable to set $file to binary: $!\n"; my $size = -s $file; read($fh, my $buffer, $size); close $fh; @@ -60,6 +61,7 @@ my $bak = "$file.bak"; my $tmp = "$file.new.".int(time()); open(my $fh, '>', $tmp) || croak "Couldn't open $tmp: $!\n"; + binmode($fh) || croak "Unable to set $file to binary: $!\n"; print $fh $buf; close $fh; if (-s $tmp ne length($buf)) {
Subject: Re: [rt.cpan.org #67534] AutoReply: No binmode on open set => fails on Win32
Date: Sun, 17 Apr 2011 18:07:39 +0200
To: Bugs in File-KeePass via RT <bug-File-KeePass [...] rt.cpan.org>
From: Sebastian Schmidt <yath [...] yath.de>
On Sun, Apr 17, 2011 at 11:55:51AM -0400, Bugs in File-KeePass via RT wrote: Show quoted text
> Patch:
Oops, the second error message was wrong. Now the correct one: diff -ur File-KeePass-0.03.old/lib/File/KeePass.pm File-KeePass-0.03/lib/File/KeePass.pm --- File-KeePass-0.03.old/lib/File/KeePass.pm 2011-04-17 17:51:37.000000000 +0200 +++ File-KeePass-0.03/lib/File/KeePass.pm 2011-04-17 18:06:03.000000000 +0200 @@ -44,6 +44,7 @@ my $pass = shift || croak "Missing pass\n"; open(my $fh, '<', $file) || croak "Couldn't open $file: $!\n"; + binmode($fh) || croak "Unable to set $file to binary: $!\n"; my $size = -s $file; read($fh, my $buffer, $size); close $fh; @@ -60,6 +61,7 @@ my $bak = "$file.bak"; my $tmp = "$file.new.".int(time()); open(my $fh, '>', $tmp) || croak "Couldn't open $tmp: $!\n"; + binmode($fh) || croak "Unable to set $tmp to binary: $!\n"; print $fh $buf; close $fh; if (-s $tmp ne length($buf)) {
This is fixed in File::KeePass 2.00 which was just released.