[PATCH] mysqlhotcopy: utf8 I/O layer

"Mike Bethune" <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
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;

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.