When I tried to use clsql-mysql I got random segfault when connecting to database or executing query. Reproducible: Always Steps to Reproduce: 1. start clisp 2. (asdf:oos 'asdf:load-op :clsql-mysql) 3. (clsql:connect '("somehost" "somedb" "someuser" "somepass") :database-type :mysql) ; you may got segfault at this point 4. (clsql:query "select 1+2") ; or at this 5. (clsql:disconnect) ; or here Actual Results: segfault or wrong result from select Expected Results: Normally I would receive result of the query execution
After playing with gdb I've finally found the reason: there are "my_malloc" and "my_realloc" symbols in both libmysqlclient.so and lisp.run binaries. So mysql call clisp's my_malloc/my_realloc instead of mysql's one. This results in undefined behavious when mysql code expects that memory block returned from my_malloc will be zero-filled.
Created attachment 167150 [details, diff] Patch which removes my_alloc and my_realloc from lisp.run dynamic symbols table
Created attachment 167151 [details] Ebuild which applies clisp-2.46-my_malloc-patch.diff
This should be fixed with clisp-2.47.