On Mon, 25 Jun 2001, Kieran Barnes wrote:

> Disclaimer: I am not a C programmer. I am guessing and attempting to be
> intelligent!

And succeeding. :-)

> Here follows an output of an strace on vuserinfo
> Some interesting things are as follows.
> 
> 102  open("/var/db/mysql/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = -1
> ENOENT (No such file or directory)
> I dont know if this error is just my installation of mysql or something
> else.
> The file vuserinfo is looking for is in
> /usr/local/mysql/share/mysql/charsets/

Try strace on some other programs that use mysql, and see if they look in
the same place.

> I don't think this the main problem though

I agree.

>    109  write(3, "L\0\0\0\3select pw_name, pw_passwd, "..., 80) = 80
>    110  read(3, "9\0\0\1", 4)                   = 4
>    111  read(3, "\377(\4You have an error in your SQL"..., 57) = 57
> This looks like vuserinfo has connected to mysql but issued a broken select
> statement and will return "vsql_getpw: failed select"

Yep, seems likely. I notice the server returned an error message which
vmysql ignored. The attached untested patch should cause that message to
be displayed (to stderr).

> Line 111 looks like the mysqld returning the error. Does any one know how I
> can get the full error returned, or the full select statement?

Use the -s (string size) option, e.g. -s 100. (You can also use the -o
option to output to a file, to avoid the trace being mixed with the
traced program's output.)

-- 
Daniel Biddle <[EMAIL PROTECTED]>


--- vmysql.c~   Fri Jun 15 07:37:35 2001
+++ vmysql.c    Mon Jun 25 18:06:51 2001
@@ -334,7 +334,8 @@
     free(in_domain);
 
     if (mysql_query(&mysql_read,SqlBufRead)) {
-        printf("vsql_getpw: failed select\n");
+        fprintf(stderr, "vmysql: select failed: %s\n",
+            mysql_error(&mysql_read));
         return(NULL);
     }
 

Reply via email to