Bug 254068

Summary: Kexi crashes while importing certain CSV file into MySQL DB
Product: [Applications] KEXI Reporter: mark75to <m.iannozzi>
Component: Migration/Import/ExportAssignee: Jarosław Staniek <staniek>
Status: CLOSED WAITINGFORINFO    
Severity: crash    
Priority: NOR    
Version: 2.2.2 (KOffice 2.2.2)   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.4 (Calligra 2.4)
Sentry Crash Report:
Bug Depends on: 279980    
Bug Blocks:    
Attachments: CSV file that is not imported properly

Description mark75to 2010-10-13 15:49:38 UTC
Application: kexi (2.2.2 (KOffice 2.2.2))
KDE Platform Version: 4.4.2 (KDE 4.4.2)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-25-generic i686
Distribution: Ubuntu 10.04.1 LTS

-- Information about the crash:
Hello, I have configured kexy to use MYSQL db. I was import a CSV file when it crash into table when KEXI crash. I have tryed 3 times. 
First time ---> Kexi crash
second time ---> Kexi was inform me that have encurred a SQL error and it haven't import it (I think that in this case KEXI must not import only line with error and go on to next line and finish file import)
third time ---> Kexi crash

Sorry for my bad english.
Best Regards. 

The crash can be reproduced every time.

 -- Backtrace:
Application: Kexi (kexi), signal: Segmentation fault
[KCrash Handler]
#6  0x096378ff in vtable for __cxxabiv1::__si_class_type_info () from /usr/lib/libstdc++.so.6
#7  0x0ae01334 in ?? ()
#8  0x005c190b in KexiDB::Connection::insertRecord(KexiDB::FieldList&, QList<QVariant> const&) () from /usr/lib/libkexidb.so.7
#9  0x024fbd82 in ?? () from /usr/lib/kde4/kexidb_mysqldriver.so
#10 0x03020263 in ?? () from /usr/lib/kde4/kexihandler_csv_importexport.so
#11 0x03024104 in ?? () from /usr/lib/kde4/kexihandler_csv_importexport.so
#12 0x0302d422 in ?? () from /usr/lib/kde4/kexihandler_csv_importexport.so
#13 0x04606443 in KDialog::slotButtonClicked(int) () from /usr/lib/libkdeui.so.5
#14 0x04608559 in KDialog::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkdeui.so.5
#15 0x03025d2a in ?? () from /usr/lib/kde4/kexihandler_csv_importexport.so
#16 0x00472c9a in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#17 0x004813d5 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#18 0x00486b13 in QSignalMapper::mapped(int) () from /usr/lib/libQtCore.so.4
#19 0x00487d8d in QSignalMapper::map(QObject*) () from /usr/lib/libQtCore.so.4
#20 0x00487f6e in QSignalMapper::map() () from /usr/lib/libQtCore.so.4
#21 0x0048803b in QSignalMapper::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#22 0x00472c9a in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#23 0x004813d5 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#24 0x0140b479 in QAbstractButton::clicked(bool) () from /usr/lib/libQtGui.so.4
#25 0x010eaea9 in ?? () from /usr/lib/libQtGui.so.4
#26 0x010ebcf4 in ?? () from /usr/lib/libQtGui.so.4
#27 0x010ebfae in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#28 0x00d3e7f8 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#29 0x010ead4e in QAbstractButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x011951f2 in QPushButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#31 0x00ce04dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#32 0x00ce79f7 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#33 0x046a4f2a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#34 0x0046da3b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#35 0x00ce6952 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#36 0x00d72088 in ?? () from /usr/lib/libQtGui.so.4
#37 0x00d71511 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#38 0x00da060a in ?? () from /usr/lib/libQtGui.so.4
#39 0x0096a5e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#40 0x0096e2d8 in ?? () from /lib/libglib-2.0.so.0
#41 0x0096e4b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#42 0x004995d5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#43 0x00da0135 in ?? () from /usr/lib/libQtGui.so.4
#44 0x0046c059 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#45 0x0046c4aa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#46 0x0121f4f3 in QDialog::exec() () from /usr/lib/libQtGui.so.4
#47 0x002b3854 in KexiMainWindow::slotProjectImportDataTable() () from /usr/lib/libkeximain.so.7
#48 0x002c80e6 in KexiMainWindow::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib/libkeximain.so.7
#49 0x00472c9a in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#50 0x004813d5 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#51 0x00cd9bd9 in QAction::triggered(bool) () from /usr/lib/libQtGui.so.4
#52 0x00cdbdcc in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQtGui.so.4
#53 0x011cebd2 in QToolButton::nextCheckState() () from /usr/lib/libQtGui.so.4
#54 0x010ebcb3 in ?? () from /usr/lib/libQtGui.so.4
#55 0x010ebfae in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#56 0x011cf09c in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQtGui.so.4
#57 0x00d3e7f8 in QWidget::event(QEvent*) () from /usr/lib/libQtGui.so.4
#58 0x010ead4e in QAbstractButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#59 0x011d1bca in QToolButton::event(QEvent*) () from /usr/lib/libQtGui.so.4
#60 0x00ce04dc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#61 0x00ce79f7 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#62 0x046a4f2a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#63 0x0046da3b in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#64 0x00ce6952 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/libQtGui.so.4
#65 0x00d72088 in ?? () from /usr/lib/libQtGui.so.4
#66 0x00d71511 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#67 0x00da060a in ?? () from /usr/lib/libQtGui.so.4
#68 0x0096a5e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#69 0x0096e2d8 in ?? () from /lib/libglib-2.0.so.0
#70 0x0096e4b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#71 0x004995d5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#72 0x00da0135 in ?? () from /usr/lib/libQtGui.so.4
#73 0x0046c059 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#74 0x0046c4aa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#75 0x0047069f in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#76 0x00ce0577 in QApplication::exec() () from /usr/lib/libQtGui.so.4
#77 0x08048764 in _start ()

Reported using DrKonqi
Comment 1 Jarosław Staniek 2010-10-13 16:17:41 UTC
Hi, thanks for reporting. Could you please try to:
1. import the CSV file into SQLite (file-based) database using Kexi?
2. add test CSV file that crashed as attachment here or send to me (staniek at kde .org)
Comment 2 mark75to 2010-10-14 14:51:07 UTC
Hello,
I have tried to import same csv file in Kexi file-based and it works good.
Sorry but I can't send data file because it contain information about my organization unit.
So let me know how can I help you.
Best Regards.
  
(In reply to comment #1)
> Hi, thanks for reporting. Could you please try to:
> 1. import the CSV file into SQLite (file-based) database using Kexi?
> 2. add test CSV file that crashed as attachment here or send to me (staniek at
> kde .org)
Comment 3 Jarosław Staniek 2010-10-14 23:30:55 UTC
I understand that you have sensitive data. In such cases it will be enough if you create CSV file with one or two lines or random data that causes problems in Kexi (you can also replace texts with XXXXXX, etc.).

Also please consider testing if the file can be imported if you use SQLite database (.kexi file) instead of MySQL. This will help me to identify source of the issues.
Comment 4 Jarosław Staniek 2012-03-07 20:40:18 UTC
Related to #279980
Comment 5 Jarosław Staniek 2012-03-07 20:42:25 UTC
Created attachment 69352 [details]
CSV file that is not imported properly

While importing this file, the mysql server responds:

Message from server: Column count doesn't match value count at row 1
SQL statement: INSERT INTO votersbook_small2(id,column_1,column_2,column_3,column_4) VALUES (NULL,NULL,NULL,'c')

Server result: 1136
Comment 6 Jarosław Staniek 2012-03-07 22:12:45 UTC
Git commit 7661374b40c0a626de0d0493bf5914aec727a843 by Jaroslaw Staniek.
Committed on 07/03/2012 at 21:45.
Pushed by staniek into branch 'master'.

KexiDB MySQL Driver: fixed crash when inserting incomplete rows

KexiDB
*MySQL Driver
**fixed crash in prepared statement execution for inserting data when number of items to insert is smaller than expected; this case could be found when importing CSV data in Kexi with fewer columns specified than expected
Related: bug 279980

FIXED-IN: 2.4 (Calligra 2.4)

M  +10   -3    kexi/doc/dev/CHANGELOG-Kexi-js
M  +8    -1    kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp
M  +1    -1    kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h

http://commits.kde.org/calligra/7661374b40c0a626de0d0493bf5914aec727a843
Comment 7 Jarosław Staniek 2012-03-07 22:27:56 UTC
Git commit 4ca56dd13fe4b97ddcd940eaa6e5ef0d9b509ad6 by Jaroslaw Staniek.
Committed on 07/03/2012 at 21:45.
Pushed by staniek into branch 'calligra/2.4'.

KexiDB MySQL Driver: fixed crash when inserting incomplete rows

KexiDB
*MySQL Driver
**fixed crash in prepared statement execution for inserting data when number of items to insert is smaller than expected; this case could be found when importing CSV data in Kexi with fewer columns specified than expected
Related: bug 279980

FIXED-IN: 2.4 (Calligra 2.4)

REVIEW: 104188

M  +1    -1    kexi/doc/dev/CHANGELOG-Kexi-js
M  +8    -1    kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.cpp
M  +1    -1    kexi/kexidb/drivers/mySQL/mysqlpreparedstatement.h

http://commits.kde.org/calligra/4ca56dd13fe4b97ddcd940eaa6e5ef0d9b509ad6
Comment 8 Jarosław Staniek 2012-03-07 22:47:37 UTC
Git commit 0c2d1ba6250e8346c5f67b3c963bc1ce1d80bead by Jaroslaw Staniek.
Committed on 07/03/2012 at 23:40.
Pushed by staniek into branch 'calligra/2.4'.

KexiDB PostgreSQL Driver: fixed crash when inserting incomplete rows

KexiDB
*PostgreSQL Driver
**fixed crash in prepared statement execution for inserting data when number of items to insert is smaller than expected; this case could be found when importing CSV data in Kexi with fewer columns specified than expected
Related: bug 279980

FIXED-IN: 2.4 (Calligra 2.4)

REVIEW: 104189

M  +8    -0    kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.cpp

http://commits.kde.org/calligra/0c2d1ba6250e8346c5f67b3c963bc1ce1d80bead
Comment 9 Jarosław Staniek 2012-03-07 22:55:35 UTC
Git commit 38da0b59e0864e69c880fbbab27e88e113eea7e5 by Jaroslaw Staniek.
Committed on 07/03/2012 at 23:40.
Pushed by staniek into branch 'master'.

KexiDB PostgreSQL Driver: fixed crash when inserting incomplete rows

KexiDB
*PostgreSQL Driver
**fixed crash in prepared statement execution for inserting data when number of items to insert is smaller than expected; this case could be found when importing CSV data in Kexi with fewer columns specified than expected
Related: bug 279980

FIXED-IN: 2.4 (Calligra 2.4)

REVIEW: 104189

M  +8    -0    kexi/kexidb/drivers/pqxx/pqxxpreparedstatement.cpp

http://commits.kde.org/calligra/38da0b59e0864e69c880fbbab27e88e113eea7e5
Comment 10 Jarosław Staniek 2012-03-07 22:59:30 UTC
Fixed related issues, also for PostgreSQL. If you confirm the fix this bug will be closed.
Comment 11 Jarosław Staniek 2012-06-27 11:28:25 UTC
Git commit 58f546cfbc490938c4049b99c81e543397b2ca6d by Jaroslaw Staniek.
Committed on 27/06/2012 at 09:49.
Pushed by staniek into branch 'master'.

MySQL & PostgreSQL Driver: Fixed crash when inserting incomplete rows

*Fixed crash in prepared statement execution for inserting data when number of items to insert is smaller than expected; this case could be found when importing CSV data in Kexi with fewer columns specified than expected
**(2012-03-07 calligra master commit 7661374b40c)
**(2012-03-07 calligra master commit 38da0b59e08)
Related: bug 279980

M  +14   -7    Drivers/mysql/MysqlPreparedStatement.cpp
M  +2    -1    Drivers/mysql/MysqlPreparedStatement.h
M  +16   -8    Drivers/postgresql/PostgresqlPreparedStatement.cpp
M  +2    -1    Drivers/postgresql/PostgresqlPreparedStatement.h
M  +4    -3    Drivers/sqlite/SqlitePreparedStatement.cpp
M  +2    -1    Drivers/sqlite/SqlitePreparedStatement.h
M  +2    -1    Predicate/Interfaces/PreparedStatementInterface.h
M  +1    -1    Predicate/PreparedStatement.cpp

http://commits.kde.org/predicate/58f546cfbc490938c4049b99c81e543397b2ca6d