Package: libdbi
Severity: grave

I try to create tables in the existing mysqldb test or in a nonexisting
sqlitedb. Later creates the db file on the fly.

With mysql I get SEGV on dbi_conn_get_table_list() function.

With sqlite the first table tbl_auth in first db file blogdb_auth is
created fine. 
In a 2nd loop run a 2nd table tbl_user in a 2nd db file
blogdb_user should be created.
The db file blogdb_user is created with 0 size but then there is a SEGV
in dbi_conn_select_db() function at

open("/home/makolb/devel/blog/tests/db/build/./db/blogdb_user",
O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getpid()                                = 9161
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


Eletricfence reports a 0 allocation:

$ LD_LIBRARY_PATH="." LD_PRELOAD="libefence.so.0" ./dbtest 

  Electric Fence 2.1 Copyright (C) 1987-1998 Bruce Perens.

ElectricFence Aborting: Allocating 0 bytes, probably a bug.
Illegal instruction


All package versions are latest from Sid.

Here is debugging and ltrace output, first for mysql and afterwards for
sqlite.

=====================================================================
MYSQL 4.0.24-10
=====================================================================

[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 8988)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 8988)]
0x4019d580 in mysql_send_query () from /usr/lib/libmysqlclient.so.12
(gdb) where
#0  0x4019d580 in mysql_send_query () from /usr/lib/libmysqlclient.so.12
#1  0x4019d9e0 in mysql_real_query () from /usr/lib/libmysqlclient.so.12
#2  0x4019d355 in mysql_query () from /usr/lib/libmysqlclient.so.12
#3  0x4001f279 in dbd_query () from /usr/lib/dbd/libmysql.so
#4  0x4001f1a5 in dbd_list_tables () from /usr/lib/dbd/libmysql.so
#5  0x4002a1d9 in dbi_conn_get_table_list () from /usr/lib/libdbi.so.0
#6  0x08049495 in db_tbl_exist (conn=0x804e028, dbname=0x804de08 "test", 
    tblname=0x804e138 "tbl_auth") at ../../src/db.c:107
#7  0x080497c7 in db_generate (conn=0x804e028, tbl=0 '\0') at
../../src/db.c:185
#8  0x080498d5 in db_install () at ../../src/db.c:220
#9  0x08048bd9 in main (argc=1, argv=0xbffffa74) at main.c:25
(gdb)


$ LD_LIBRARY_PATH="." ltrace ./dbtest 
__libc_start_main(0x8048b74, 1, 0xbffffaa4, 0x804ae90, 0x804aef0
<unfinished ...>
confpars_readconf(0x804afa8, 0x804daa0, 11, 0x40016ca0, 0x804ae90) =
0x804dd38
malloc(44)                                           = 0x804dda8
strlen("./templates")                                = 11
malloc(12)                                           = 0x804ddd8
strcpy(0x804ddd8, "./templates")                     = 0x804ddd8
strlen("mysql")                                      = 5
malloc(6)                                            = 0x804dde8
strcpy(0x804dde8, "mysql")                           = 0x804dde8
strlen("localhost")                                  = 9
malloc(10)                                           = 0x804ddf8
strcpy(0x804ddf8, "localhost")                       = 0x804ddf8
atoi(0x804df70, 0x804df60, 11, 0x40016ca0, 0x804ae90) = 0
strlen("test")                                       = 4
malloc(5)                                            = 0x804de08
strcpy(0x804de08, "test")                            = 0x804de08
strlen("root")                                       = 4
malloc(5)                                            = 0x804de18
strcpy(0x804de18, "root")                            = 0x804de18
strlen("")                                           = 0
malloc(1)                                            = 0x804de28
strcpy(0x804de28, "")                                = 0x804de28
strlen("./db")                                       = 4
malloc(5)                                            = 0x804de38
strcpy(0x804de38, "./db")                            = 0x804de38
strlen("test")                                       = 4
malloc(5)                                            = 0x804de48
strcpy(0x804de48, "test")                            = 0x804de48
atoi(0x804dfd0, 0x804df90, 11, 0x40016ca0, 0x804ae90) = 1
strlen("")                                           = 0
malloc(1)                                            = 0x804de58
strcpy(0x804de58, "")                                = 0x804de58
confpars_freemem(0x804dd38, 0x804e018, 11, 0x40016ca0, 0x804ae90) = 0
printf("DB_TYPE: %s\nMYSQL_USER: %s\n", "mysql", "root"DB_TYPE: mysql
MYSQL_USER: root
) = 32
dbi_initialize(0, 0x804dcb4, 25, 0x80486db, 0x40034e3c) = 2
dbi_conn_new(0x804dde8, 0x804dcb4, 25, 0x80486db, 0x40034e3c) =
0x804e028
strcmp("mysql", "sqlite")                            = -6
strcmp("mysql", "mysql")                             = 0
dbi_conn_set_option(0x804e028, 0x804bd90, 0x804ddf8, 0x80486db,
0x804e028) = 0
dbi_conn_set_option_numeric(0x804e028, 0x804bd95, 0, 0x80486db,
0x804e028) = 0
dbi_conn_set_option(0x804e028, 0x804bd9a, 0x804de18, 0x80486db,
0x804e028) = 0
strcmp("", "")                                       = 0
dbi_conn_set_option(0x804e028, 0x804bd76, 0x804de08, 0x80486db,
0x804e028) = 0
dbi_conn_get_driver(0x804e028, 0xbffffaa4, 0xbffff9e8, 0x40029bf1, 0) =
0x804fe68
dbi_driver_get_name(0x804fe68, 0xbffffaa4, 0xbffff9e8, 0x40029bf1, 0) =
0x4001fb00
strcmp("mysql", "sqlite")                            = -6
dbi_conn_get_driver(0x804e028, 0x804bd6f, 0xbffff9e8, 0x40029bf1, 0) =
0x804fe68
dbi_driver_get_name(0x804fe68, 0x804bd6f, 0xbffff9e8, 0x40029bf1, 0) =
0x4001fb00
strcmp("mysql", "mysql")                             = 0
strlen("")                                           = 0
strlen("auth")                                       = 4
malloc(9)                                            = 0x804e138
strcpy(0x804e138, "")                                = 0x804e138
strcat("", "tbl_")                                   = "tbl_"
strcat("tbl_", "auth")                               = "tbl_auth"
dbi_conn_get_table_list(0x804e028, 0x804de08, 0x804e138, 735, 0x400a57d0
<unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++



=====================================================================
SQLITE 2.8.16-1
=====================================================================


[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 9145)]
0x804e028, CREATE TABLE tbl_auth (id INTEGER NOT NULL,
session_hash CHAR(41) UNIQUE NOT NULL,         login_date TIMESTAMP NOT
NULL DEFAULT 'NOW()',         PRIMARY KEY (id)         );

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 9145)]
0x400a3560 in mallopt () from /lib/libc.so.6
(gdb) where
#0  0x400a3560 in mallopt () from /lib/libc.so.6
#1  0x400a2dcb in mallopt () from /lib/libc.so.6
#2  0x400a1fb3 in malloc () from /lib/libc.so.6
#3  0x4025f665 in sqliteMalloc () from /usr/lib/libsqlite.so.0
#4  0x4024f475 in sqlitepager_open () from /usr/lib/libsqlite.so.0
#5  0x40236a73 in sqliteBtreeOpen () from /usr/lib/libsqlite.so.0
#6  0x4024d284 in sqliteBtreeFactory () from /usr/lib/libsqlite.so.0
#7  0x4024c37d in sqlite_open () from /usr/lib/libsqlite.so.0
#8  0x4018b121 in _real_dbd_connect () from /usr/lib/dbd/libsqlite.so
#9  0x4018c60b in dbd_select_db () from /usr/lib/dbd/libsqlite.so
#10 0x4002a3df in dbi_conn_select_db () from /usr/lib/libdbi.so.0
#11 0x080495c8 in db_dbname_get (conn=0x804e028, tblname=0x804bcee
"user")
    at ../../src/db.c:137
#12 0x0804970d in db_generate (conn=0x804e028, tbl=1 '\001') at
../../src/db.c:174
#13 0x080498d5 in db_install () at ../../src/db.c:220
#14 0x08048bd9 in main (argc=1, argv=0xbffffa74) at main.c:25
(gdb)



$ LD_LIBRARY_PATH="." ltrace ./dbtest 
__libc_start_main(0x8048b74, 1, 0xbffffa94, 0x804ae90, 0x804aef0
<unfinished ...>
confpars_readconf(0x804afa8, 0x804daa0, 11, 0x40016ca0, 0x804ae90) =
0x804dd38
malloc(44)                                           = 0x804dda8
strlen("./templates")                                = 11
malloc(12)                                           = 0x804ddd8
strcpy(0x804ddd8, "./templates")                     = 0x804ddd8
strlen("sqlite")                                     = 6
malloc(7)                                            = 0x804dde8
strcpy(0x804dde8, "sqlite")                          = 0x804dde8
strlen("localhost")                                  = 9
malloc(10)                                           = 0x804ddf8
strcpy(0x804ddf8, "localhost")                       = 0x804ddf8
atoi(0x804df70, 0x804df60, 11, 0x40016ca0, 0x804ae90) = 0
strlen("test")                                       = 4
malloc(5)                                            = 0x804de08
strcpy(0x804de08, "test")                            = 0x804de08
strlen("root")                                       = 4
malloc(5)                                            = 0x804de18
strcpy(0x804de18, "root")                            = 0x804de18
strlen("")                                           = 0
malloc(1)                                            = 0x804de28
strcpy(0x804de28, "")                                = 0x804de28
strlen("./db")                                       = 4
malloc(5)                                            = 0x804de38
strcpy(0x804de38, "./db")                            = 0x804de38
strlen("test")                                       = 4
malloc(5)                                            = 0x804de48
strcpy(0x804de48, "test")                            = 0x804de48
atoi(0x804dfd0, 0x804df90, 11, 0x40016ca0, 0x804ae90) = 1
strlen("")                                           = 0
malloc(1)                                            = 0x804de58
strcpy(0x804de58, "")                                = 0x804de58
confpars_freemem(0x804dd38, 0x804e018, 11, 0x40016ca0, 0x804ae90) = 0
printf("DB_TYPE: %s\nMYSQL_USER: %s\n", "sqlite", "root"DB_TYPE: sqlite
MYSQL_USER: root
) = 33
dbi_initialize(0, 0x804dcb4, 25, 0x80486db, 0x40034e3c) = 2
dbi_conn_new(0x804dde8, 0x804dcb4, 25, 0x80486db, 0x40034e3c) =
0x804e028
strcmp("sqlite", "sqlite")                           = 0
dbi_conn_set_option(0x804e028, 0x804bd76, 0x804de48, 0x80486db,
0x804e028) = 0
dbi_conn_set_option(0x804e028, 0x804bd7d, 0x804de38, 0x80486db,
0x804e028) = 0
dbi_conn_get_driver(0x804e028, 0xbffffa94, 0xbffff9d8, 0x40029bf1, 0) =
0x8050960
dbi_driver_get_name(0x8050960, 0xbffffa94, 0xbffff9d8, 0x40029bf1, 0) =
0x4018cda0
strcmp("sqlite", "sqlite")                           = 0
strlen("auth")                                       = 4
malloc(12)                                           = 0x804e0e0
strcpy(0x804e0e0, "blogdb_")                         = 0x804e0e0
strcat("blogdb_", "auth")                            = "blogdb_auth"
dbi_conn_select_db(0x804e028, 0x804e0e0, 0xbffff9d8, 0x40029bf1,
0x804e0e0) = 0
strlen("")                                           = 0
strlen("auth")                                       = 4
malloc(9)                                            = 0x8052ba0
strcpy(0x8052ba0, "")                                = 0x8052ba0
strcat("", "tbl_")                                   = "tbl_"
strcat("tbl_", "auth")                               = "tbl_auth"
dbi_conn_get_table_list(0x804e028, 0x804e0e0, 0x8052ba0, 0x804dc58, 0) =
0x8058128
dbi_result_get_string_idx(0x8058128, 1, 0x8052ba0, 0x804dc58, 0x8058128)
= 0x4002faf0
strcmp("ERROR", "tbl_auth")                          = -47
dbi_result_free(0x8058128, 0x8052ba0, 0x8052ba0, 0x804dc58, 0x8058128) =
0
printf("%p, CREATE TABLE %s %s\n", 0x804e028, "tbl_auth", "(id INTEGER
NOT NULL,         se"...0x804e028, CREATE TABLE tbl_auth (id INTEGER NOT
NULL,         session_hash CHAR(41) UNIQUE NOT NULL,         login_date
TIMESTAMP NOT NULL DEFAULT 'NOW()',         PRIMARY KEY (id)         );
) = 193
dbi_conn_queryf(0x804e028, 0x804bdd2, 0x8052ba0, 0x804b0c0, 0x804e028) =
0x8057e18
free(0x8052ba0)                                      = <void>
dbi_conn_get_driver(0x804e028, 0x40161300, 0x8052ba0, 0x804dc58, 0) =
0x8050960
dbi_driver_get_name(0x8050960, 0x40161300, 0x8052ba0, 0x804dc58, 0) =
0x4018cda0
strcmp("sqlite", "sqlite")                           = 0
free(0x804e0e0)                                      = <void>
dbi_result_free(0x8057e18, 0x804e0e0, 0x8052ba0, 0x804b0c0, 0x804e028) =
0
free(0x8052ba0)                                      = <void>
dbi_conn_get_driver(0x804e028, 0x40161300, 0x8052ba0, 0x804dc58, 0) =
0x8050960
dbi_driver_get_name(0x8050960, 0x40161300, 0x8052ba0, 0x804dc58, 0) =
0x4018cda0
strcmp("sqlite", "sqlite")                           = 0
free(0x804e0e0)                                      = <void>
dbi_conn_get_driver(0x804e028, 0x804bd6f, 0x8052ba0, 0x804dc58, 0) =
0x8050960
dbi_driver_get_name(0x8050960, 0x804bd6f, 0x8052ba0, 0x804dc58, 0) =
0x4018cda0
strcmp("sqlite", "sqlite")                           = 0
strlen("user")                                       = 4
malloc(12)                                           = 0x804e0e0
strcpy(0x804e0e0, "blogdb_")                         = 0x804e0e0
strcat("blogdb_", "user")                            = "blogdb_user"
dbi_conn_select_db(0x804e028, 0x804e0e0, 0x8052ba0, 0x804dc58, 0x804e0e0
<unfinished ...>
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++



-- System Information:
Debian Release: sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.27-2-686
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to