Bug #23074 typo in myisam/sort.c
Submitted: 7 Oct 2006 13:52 Modified: 6 Nov 2006 14:54
Reporter: jose nazario Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.24a/4.1BK/5.0BK/5.1BK OS:Any (All)
Assigned to: Andrey Hristov CPU Architecture:Any
Tags: sort, typo

[7 Oct 2006 13:52] jose nazario
Description:
minor typo in myisam/sort.c that looks like it doesn't properly check for HA_VAR_LENGTH_KEY. it's been there since 4.x it seems ... patch below. 

found via google codesearch.

How to repeat:
N/A

Suggested fix:
--- myisam/sort.c.orig  Sat Oct  7 09:47:25 2006
+++ myisam/sort.c       Sat Oct  7 09:47:59 2006
@@ -324,7 +324,7 @@
   if (info->sort_info->got_error)
     goto err;
 
-  if (info->keyinfo->flag && HA_VAR_LENGTH_KEY)
+  if (info->keyinfo->flag & HA_VAR_LENGTH_KEY)
   {
     info->write_keys=write_keys_varlen;
     info->read_to_buffer=read_to_buffer_varlen;
@@ -518,7 +518,7 @@
   {
     if (got_error)
       continue;
-    if (sinfo->keyinfo->flag && HA_VAR_LENGTH_KEY)
+    if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY)
     {
       sinfo->write_keys=write_keys_varlen;
       sinfo->read_to_buffer=read_to_buffer_varlen;
[10 Oct 2006 0:58] MySQL Verification Team
Thank you for the bug report.
[11 Oct 2006 9:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/13457

ChangeSet@1.2555, 2006-10-11 11:07:25+02:00, andrey@example.com +1 -0
  Fix a typo regarding checking whether HA_VAR_LENGTH_KEY is
  set. This has always worked because when flag is !=0 then
  HA_VAR_LENGTH_KEY is always set. Therefore, a test case cannot
  reveal a faulty behavior.
  
  Fix for bug#23074: typo in myisam/sort.c
[6 Nov 2006 14:54] Paul DuBois
No changelog entry needed.