Bug #3131 mysqltest fails on $2=$1 assignment in test

Submitted: 10 Mar 2004 13:32 Modified: 1 Sep 2005 19:19
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0-bk OS:
Assigned to: Magnus BlÄudd CPU Architecture:Any

[10 Mar 2004 13:32] Sergey Petrunya
Description:
mysqltest fails if one variable assigned to another.

How to repeat:
Create a test file:
let $1=1;
let $2=$1;

Run it with mysql-test-run and get this:

Error: Reallocating NULL pointer at line 962, 'mysqltest.c'
/home/psergey/mysql-5.0-wl1394/client/mysqltest: Out of memory

Suggested fix:
allow $var1=$var2 assignments in mysql-test.
[18 Jun 2004 20:57] Greg Weir
Requires a re-working of the way variable substitution is handled in mysqltest.c
[16 Feb 2005 11:48] Alexander Barkov
Vasiliy, please take a look into Sergey's letter in reply to your
commit wax:1.1956.

Please remove this change from your patch:

-  if (dest->alloced_len < src->alloced_len &&
-      !(dest->str_val=my_realloc(dest->str_val,src->alloced_len+1,
-				 MYF(MY_WME))))
-    die("Out of memory");
+  if (dest->alloced_len < src->alloced_len && 
+    !(dest->str_val= dest->str_val 
+                    ? my_realloc(dest->str_val, src->alloced_len+1, MYF(MY_WME)) 
+                    : my_malloc(src->alloced_len+1, MYF(MY_WME))))
+      die("Out of memory");

Keep only this part of the patch:

   dest->str_val_len=src->str_val_len;
+  dest->alloced_len= src->alloced_len+1;
   memcpy(dest->str_val,src->str_val,src->str_val_len+1);
 }
 

Then please add checking for variable to variable assignment
into some test, and push the change.

I'm changing the status of this bug into In progress.
[1 Sep 2005 8:53] 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/internals/29157
[1 Sep 2005 19:19] Paul DuBois
No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.064 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.