I just found a bug in Pike under Solaris. I changed the layout of my mysql installation a bit and therefor I had to put some new options in my /etc/my.cnf. Since I want my pike-applications to use that file for the defaults, I tried
object o = Sql.sql("mysql://localhost/db", ([ "mysql_config_file":"/etc/my.cnf" ]));
which should give me access to the database. Instead I get a backtrace. After some investigation, I've found the following in modules/Mysql/mysql.c:
static void pike_mysql_set_options(struct mapping *options) { struct svalue *val;
#ifdef HAVE_MYSQL_OPTIONS #ifdef MYSQL_READ_DEFAULT_FILE if ((val = simple_mapping_string_lookup(options, "mysql_config_file")) && (val->type == T_STRING) && (!val->u.string->size_shift)) { printf("READING MYSQL-DEFAULTS..."); mysql_options(PIKE_MYSQL->mysql, MYSQL_READ_DEFAULT_FILE, val->u.string->str); } #endif
...
#endif
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
So, what causes all the inner ifdefs in pike_mysql_set_options() to fail? Right now I'm using one of the latest Pike 7.3 from CVS and a mysql 4.0.10-gamma server.
If it is as you say then your cpp is broken in a way that I've never seen any cpp being broken. A suggestion is to trace the scope of the definition by inserting
#ifdef MYSQL_READ_DEFAULT_FILE #error foo #endif
here and there.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-02-19 01:51: Subject: Mysql
I just found a bug in Pike under Solaris. I changed the layout of my mysql installation a bit and therefor I had to put some new options in my /etc/my.cnf. Since I want my pike-applications to use that file for the defaults, I tried
object o = Sql.sql("mysql://localhost/db", ([ "mysql_config_file":"/etc/my.cnf" ]));
which should give me access to the database. Instead I get a backtrace. After some investigation, I've found the following in modules/Mysql/mysql.c:
static void pike_mysql_set_options(struct mapping *options) { struct svalue *val;
#ifdef HAVE_MYSQL_OPTIONS #ifdef MYSQL_READ_DEFAULT_FILE if ((val = simple_mapping_string_lookup(options, "mysql_config_file")) && (val->type == T_STRING) && (!val->u.string->size_shift)) { printf("READING MYSQL-DEFAULTS..."); mysql_options(PIKE_MYSQL->mysql, MYSQL_READ_DEFAULT_FILE, val->u.string->str); } #endif
...
#endif
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
So, what causes all the inner ifdefs in pike_mysql_set_options() to fail? Right now I'm using one of the latest Pike 7.3 from CVS and a mysql 4.0.10-gamma server.
/ Marcus Agehall (Trådlös)
I will try something like that next week. I don't have time to tinker around with the thing right now. But as far as I can tell, the problem is related to gcc cpp or some other obscure solaris bug. But since I havn't finished experimenting, I'm not about to start pointing fingers as of yet...
/ Marcus Agehall (Trådlös)
Previous text:
2003-02-19 22:53: Subject: Mysql
If it is as you say then your cpp is broken in a way that I've never seen any cpp being broken. A suggestion is to trace the scope of the definition by inserting
#ifdef MYSQL_READ_DEFAULT_FILE #error foo #endif
here and there.
/ Martin Stjernholm, Roxen IS
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
Enums are NOT defines, and can thus not be tested for with #ifdef et al. Write a configure-test for the enum value you want to use.
/ Henrik Grubbström (Lysator)
Previous text:
2003-02-19 01:51: Subject: Mysql
I just found a bug in Pike under Solaris. I changed the layout of my mysql installation a bit and therefor I had to put some new options in my /etc/my.cnf. Since I want my pike-applications to use that file for the defaults, I tried
object o = Sql.sql("mysql://localhost/db", ([ "mysql_config_file":"/etc/my.cnf" ]));
which should give me access to the database. Instead I get a backtrace. After some investigation, I've found the following in modules/Mysql/mysql.c:
static void pike_mysql_set_options(struct mapping *options) { struct svalue *val;
#ifdef HAVE_MYSQL_OPTIONS #ifdef MYSQL_READ_DEFAULT_FILE if ((val = simple_mapping_string_lookup(options, "mysql_config_file")) && (val->type == T_STRING) && (!val->u.string->size_shift)) { printf("READING MYSQL-DEFAULTS..."); mysql_options(PIKE_MYSQL->mysql, MYSQL_READ_DEFAULT_FILE, val->u.string->str); } #endif
...
#endif
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
So, what causes all the inner ifdefs in pike_mysql_set_options() to fail? Right now I'm using one of the latest Pike 7.3 from CVS and a mysql 4.0.10-gamma server.
/ Marcus Agehall (Trådlös)
Shouldn't it be possible to use an #if MYSQL_READ_DEFAULT_FILE>0 then? I'll write a configure-test anyway, but I'm curious...
/ Marcus Agehall (Trådlös)
Previous text:
2003-02-19 22:58: Subject: Mysql
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
Enums are NOT defines, and can thus not be tested for with #ifdef et al. Write a configure-test for the enum value you want to use.
/ Henrik Grubbström (Lysator)
No. The preprocessor doesn't know anything about enums, so it can't know the value of MYSQL_READ_DEFAULT_FILE any more than it could know the value of a variable.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-02-19 23:46: Subject: Mysql
Shouldn't it be possible to use an #if MYSQL_READ_DEFAULT_FILE>0 then? I'll write a configure-test anyway, but I'm curious...
/ Marcus Agehall (Trådlös)
Ok, then there has been a HUGE bug in the MySQL module for quite a while... ;) I'll fix it next week when I'm back in Linköping again.
/ Marcus Agehall (Trådlös)
Previous text:
2003-02-19 23:48: Subject: Mysql
No. The preprocessor doesn't know anything about enums, so it can't know the value of MYSQL_READ_DEFAULT_FILE any more than it could know the value of a variable.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
pike-devel@lists.lysator.liu.se