[PATCH] mysqlhotcopy: utf8 I/O layer

[PATCH] mysqlhotcopy: utf8 I/O layer

am 04.03.2004 22:24:28 von Mike Bethune

On rhel3/perl 5.8 (for eg), mysqlhotcopy when copying a small index file =
would say:
"Can't read index header from ..." because the value returned for =
$length is < 1024.
But if the filehandle was open()ed as a UTF-8 encoded file w/Unicode =
characters,
read returns characters not bytes...

The below patch works on the above platform and is backward compatible =
too.
Thanks,
Mike


--- mysqlhotcopy.orig Tue Feb 17 11:51:06 2004
+++ mysqlhotcopy Thu Mar 4 12:54:48 2004
@@ -616,6 +616,7 @@ sub copy_index
my $to=3D"$target/$file";
my $buff;
open(INPUT, "<$from") || die "Can't open file $from: $!\n";
+ binmode(INPUT, ":raw");
my $length=3Dread INPUT, $buff, 2048;
die "Can't read index header from $from\n" if ($length < 1024);
close INPUT;

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=3Dgcdmb-bugs@m.gmane.org

Re: [PATCH] mysqlhotcopy: utf8 I/O layer

am 05.03.2004 12:53:42 von Sinisa Milivojevic

Mike Bethune writes:
> On rhel3/perl 5.8 (for eg), mysqlhotcopy when copying a small index file would say:
> "Can't read index header from ..." because the value returned for $length is < 1024.
> But if the filehandle was open()ed as a UTF-8 encoded file w/Unicode characters,
> read returns characters not bytes...
>
> The below patch works on the above platform and is backward compatible too.
> Thanks,
> Mike
>
>
> --- mysqlhotcopy.orig Tue Feb 17 11:51:06 2004
> +++ mysqlhotcopy Thu Mar 4 12:54:48 2004
> @@ -616,6 +616,7 @@ sub copy_index
> my $to="$target/$file";
> my $buff;
> open(INPUT, "<$from") || die "Can't open file $from: $!\n";
> + binmode(INPUT, ":raw");
> my $length=read INPUT, $buff, 2048;
> die "Can't read index header from $from\n" if ($length < 1024);
> close INPUT;

Thanks for the patch.

Our mysqlhotcopy maintainer will send you his comments.

--

Sincerely,

--
For technical support contracts, go to https://order.mysql.com/?ref=msmi
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB
/_/ /_/\_, /___/\___\_\___/ Full time Developer and Support Coordinator
<___/ www.mysql.com Larnaca, Cyprus

Meet the MySQL at User Conference ! (April 14-16, 2004)
http://www.mysql.com/uc2004/


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org