Below is the list of changes that have just been committed into a local
5.0 repository of hartmut. When hartmut does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2006-09-13 23:19:18+02:00, hartmut@stripped +3 -0
Fixed host name comparison (still Bug #17582)
mysql-test/r/ndb_config.result@stripped, 2006-09-13 23:19:14+02:00, hartmut@stripped +3 -0
test case for Bug #17582
mysql-test/t/ndb_config.test@stripped, 2006-09-13 23:19:15+02:00, hartmut@stripped +5 -0
test case for Bug #17582
ndb/tools/ndb_config.cpp@stripped, 2006-09-13 23:19:15+02:00, hartmut@stripped +19 -4
gethostname() returns a pointer to a static buffer so we
need to create a copy of the results before calling it on
the 2nd host name, else we're effectively comparing a
hostname to itself which is of course always true
(Bug #17582)
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: hartmut
# Host: linux.site
# Root: /home/hartmut/projects/mysql/dev/teamtrees/mysql-5.0-ndb
--- 1.6/mysql-test/r/ndb_config.result 2006-09-13 23:19:25 +02:00
+++ 1.7/mysql-test/r/ndb_config.result 2006-09-13 23:19:25 +02:00
@@ -9,3 +9,6 @@
ndbd,2,localhost ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndb_mgmd,6,localhost
mysqld,1, mysqld,7, mysqld,8, mysqld,9, mysqld,10,
ndbd,3,localhost ndbd,4,localhost ndbd,5,localhost ndbd,6,localhost ndb_mgmd,1,localhost
ndb_mgmd,2,localhost mysqld,11, mysqld,12, mysqld,13, mysqld,14, mysqld,15,
shm,3,4,35,3 shm,3,5,35,3 shm,3,6,35,3 shm,4,5,35,4 shm,4,6,35,4 shm,5,6,35,5
tcp,11,3,55,3 tcp,11,4,55,4 tcp,11,5,55,5 tcp,11,6,55,6 tcp,12,3,55,3 tcp,12,4,55,4
tcp,12,5,55,5 tcp,12,6,55,6 tcp,13,3,55,3 tcp,13,4,55,4 tcp,13,5,55,5 tcp,13,6,55,6
tcp,14,3,55,3 tcp,14,4,55,4 tcp,14,5,55,5 tcp,14,6,55,6 tcp,15,3,55,3 tcp,15,4,55,4
tcp,15,5,55,5 tcp,15,6,55,6 tcp,1,3,55,1 tcp,1,4,55,1 tcp,1,5,55,1 tcp,1,6,55,1
tcp,2,3,55,2 tcp,2,4,55,2 tcp,2,5,55,2 tcp,2,6,55,2
+1 2 3
+
+1 2 3
--- 1.11/mysql-test/t/ndb_config.test 2006-09-13 23:19:25 +02:00
+++ 1.12/mysql-test/t/ndb_config.test 2006-09-13 23:19:25 +02:00
@@ -16,3 +16,8 @@
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster1
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host
--mycnf 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --query=type,nodeid,host
--mycnf 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2
--defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections
--query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
+
+
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost
--config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4
--config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1
--config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
--- 1.14/ndb/tools/ndb_config.cpp 2006-09-13 23:19:25 +02:00
+++ 1.15/ndb/tools/ndb_config.cpp 2006-09-13 23:19:25 +02:00
@@ -411,28 +411,43 @@
if(iter.get(m_key, &valc) == 0)
{
- struct hostent *h1, *h2;
+ struct hostent *h1, *h2, copy1;
+ char *addr1;
+ int stat;
h1 = gethostbyname(m_value.c_str());
if (h1 == NULL) {
return 0;
}
+ // gethostbyname returns a pointer to a static structure
+ // so we need to copy the results before doing the next call
+ memcpy(©1, h1, sizeof(struct hostent));
+ addr1 = (char *)malloc(copy1.h_length);
+ memcpy(addr1, h1->h_addr, copy1.h_length);
+
h2 = gethostbyname(valc);
if (h2 == NULL) {
+ free(addr1);
return 0;
}
- if (h1->h_addrtype != h2->h_addrtype) {
+ if (copy1.h_addrtype != h2->h_addrtype) {
+ free(addr1);
return 0;
}
- if (h1->h_length != h2->h_length)
+ if (copy1.h_length != h2->h_length)
{
+ free(addr1);
return 0;
}
- return 0 == memcmp(h1->h_addr, h2->h_addr, h1->h_length);
+ stat = memcmp(addr1, h2->h_addr, copy1.h_length);
+
+ free(addr1);
+
+ return (stat == 0);
}
return 0;
| Thread |
|---|
| • bk commit into 5.0 tree (hartmut:1.2261) BUG#17582 | 'Hartmut Holzgraefe' | 13 Sep |