Bug 67145 - CRASH: ODBC - Firebird: Attempting to edit table definition causes abort
Summary: CRASH: ODBC - Firebird: Attempting to edit table definition causes abort
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2013-07-21 20:05 UTC by Robert Großkopf
Modified: 2020-02-10 08:14 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
libOdbcFb.so 2.0.3.154 64bit (1.09 MB, application/x-sharedlib)
2014-12-29 16:16 UTC, Robert Großkopf
Details
bt with debug symbols (12.53 KB, text/plain)
2014-12-29 21:56 UTC, Julien Nabet
Details
gdb backtrace full (46.47 KB, text/plain)
2020-02-10 03:24 UTC, Terrence Enger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Großkopf 2013-07-21 20:05:07 UTC
I try the connection between Firebird and LO-Base through ODBC. When I try to edit any existing table or try to start the wizard for editing a table LO will shutdown immediately.

System and ODBC-settings see https://bugs.freedesktop.org/show_bug.cgi?id=67144.
Comment 1 ribotb 2013-12-02 13:16:48 UTC
Hi,

I use Firebird databases with ODBC driver since many versions of LO and i never had this problem.

Actually my version of LO is 4.1.4.1 ans I have no problem.

Bernard Ribot
Comment 2 Robert Großkopf 2013-12-02 15:39:43 UTC
(In reply to comment #1)
> Hi,
> 
> I use Firebird databases with ODBC driver since many versions of LO and i
> never had this problem.
> 
> Actually my version of LO is 4.1.4.1 ans I have no problem.

Hello Bernhard,

could you please have a look at the ODBC-settings, reported in https://bugs.freedesktop.org/show_bug.cgi?id=67144 ? Could be that there are parameters in your settings that must be added to work here for me, too.

Regards

Robert
Comment 3 ribotb 2013-12-02 17:48:55 UTC
Hi Robert,

I forgot to say that my PC is under Windows 7. However that is my configuration, if it can help you :

odbcinst.ini :
[ODBC 32 bit Drivers]
Firebird/InterBase(r) driver (32 bit)=Installed
[Firebird/InterBase(r) driver (32 bit)]
Driver=C:\Windows\system32\OdbcFb.dll
Setup=C:\Windows\system32\OdbcFb.dll
32Bit=1

odbc.ini :
[ODBC 32 bit Data Sources]
fb_logiciels=Firebird/InterBase(r) driver (32 bit)
fb_bd1test=Firebird/InterBase(r) driver (32 bit)
[fb_logiciels]
Driver32=C:\Windows\system32\OdbcFb.dll
[fb_bd1test]
Driver32=C:\Windows\system32\OdbcFb.dll

Regards,
Bernard
Comment 4 Julien Nabet 2014-12-20 18:25:26 UTC
Robert: I haven't tried yet to reproduce but:
1) do you reproduce this on last stable LO version?
2) I think you're on OpenSuse, do you use OpenSuse 13.2 (see this comment https://bugs.freedesktop.org/show_bug.cgi?id=65830#c37)?

Finally, I just learnt about different Firebird versions:
- classic/super classic
- superserver
which version do you use?
Comment 5 Robert Großkopf 2014-12-20 19:18:22 UTC
(In reply to Julien Nabet from comment #4)
> Robert: I haven't tried yet to reproduce but:
> 1) do you reproduce this on last stable LO version?

Have just tested with LO 4.3.5.2 on OpenSUSE 12.3. If I want to create a table with Firebird and ODBC LO crashes immediately.
The tables I created were created by the JDBC-connection.
I could connect to the database, could see the content of the tables but could not create new tables, edit tables or put any integer-value in a table.

> 2) I think you're on OpenSuse, do you use OpenSuse 13.2 (see this comment
> https://bugs.freedesktop.org/show_bug.cgi?id=65830#c37)?

No, I'm using OpenSUSE 12.3. I will see if I could test this with my little netbook and OpenSUSE 13.2 - haven't installed this version yet.
> 
> Finally, I just learnt about different Firebird versions:
> - classic/super classic
> - superserver
> which version do you use?

Have had a look. There is installed the classic and the normal server-version. I have installed it only for testing for the Base-Handbook. So I don't know much about the different versions.
The installed version is firebird-2.5.4.26821-85.1.
ODBC-version is 2.2.12-219.1.1
Comment 6 Julien Nabet 2014-12-20 20:31:58 UTC
Thank you Robert for your feedback.

I installed Firebird 2.5 classic, created a database with Flamerobin.

Now I'm stucked because there's no odbc Firebird lib on Debian.
Indeed, I tried to install OdbcFb-LIB-2.0.3.154.amd64.gz, but gunzip indicates it's not gzip format.
There are also sources but seems not very user friendly to install...

Anyway, since I don't have more questions, I put it back to UNCONFIRMED.
Comment 7 Alex Thurgood 2014-12-29 08:48:26 UTC
Adding Lionel to CC

@Lionel : could it be that bug 34432 has reared its ugly head again ?
Comment 8 Alex Thurgood 2014-12-29 09:01:27 UTC
(In reply to Julien Nabet from comment #6)

Hi Julien,
 
> Now I'm stucked because there's no odbc Firebird lib on Debian.
> Indeed, I tried to install OdbcFb-LIB-2.0.3.154.amd64.gz, but gunzip
> indicates it's not gzip format.
> There are also sources but seems not very user friendly to install...
> 

On my Linux Mint 17 (Ubuntu 14.04) system, the gz unzips to a folder which contains a tar which untars to the libOdbcFB.so shared object library. On my system, I copied this into /usr/lib/x86_64-linux-gnu/odbc/, which is where all the 64bit drivers are stored.

However, there seems to be something wrong with the library as I don't seem to be able to get it to load properly. I might try building it from source to see if the results differ.
Comment 9 Alex Thurgood 2014-12-29 09:21:20 UTC
@Robert : my initial reading of your submission was that you couldn't edit data in the tables, but I think that what you are actually saying is that you can't edit the table definition ?
Comment 10 Alex Thurgood 2014-12-29 09:24:04 UTC
BTW, I can connect from LO to the sample employee database provided with Firebird 2.5 using the 64bit driver downloaded from the Firebird website.
Comment 11 Alex Thurgood 2014-12-29 09:28:11 UTC
CONFIRMING crash with LO Version: 4.3.5.2
Build ID: 3a87456aaa6a95c63eea1c1b3201acedf0751bd5

As soon as I select a table, and choose Edit from the context menu, LO aborts.
Comment 12 Alex Thurgood 2014-12-29 09:34:10 UTC
Steps to reproduce :

1) 64bit version of LibreOffice
2) 64bit version of the Firebird ODBC driver
3) Create an odbcinst.ini entry for the driver - this is dependent on your OS
4) Create an odbc.ini entry for a datasource - Firebird 2.5 supplies an employee.fdb sample database for testing purposes.
5) Setup a ODB file which connects to the employee.fdb file via ODBC (e.g. using the db creation wizard)
6) Open ODB file.
7) Select a table with the mouse from the list of available tables
8) Right mouse button click on the table entry to bring up the context menu, then choose "Edit"

9) LO aborts.

What should happen : LO should open the table definition for editing.
Comment 13 Alex Thurgood 2014-12-29 09:35:02 UTC
I don't have a debug build on Linux to hand to obtain a backtrace, so that will have to wait or be done by someone else.
Comment 14 Robert Großkopf 2014-12-29 09:58:13 UTC
(In reply to Alex Thurgood from comment #9)
> @Robert : my initial reading of your submission was that you couldn't edit
> data in the tables, but I think that what you are actually saying is that
> you can't edit the table definition ?

Only creating a table by the GUI or changing a table by the GUI produces a crash. I could put data into tables (if there isn't an integer-value as primary-key).

But notice:
I could create a table through Tools → SQL.
I could input all data through Tools → SQL.

Try this with Firebird - ODBC:
CREATE TABLE "Test" ("ID" INT PRIMARY KEY, "Text" VARCHAR(50));
INSERT INTO "Tabelle" ("ID","Text") VALUES (1,'Nobody');

Works well, refreshing the table-view and the table is shown.
Comment 15 Julien Nabet 2014-12-29 13:04:33 UTC
Alex: I still fail to gunzip odbc driver, OdbcFb-LIB-2.0.3.154.amd64.gz, from here: http://www.firebirdsql.org/en/odbc-driver/
Would it be possible you attach the so file so I may give it a try?
Comment 16 Robert Großkopf 2014-12-29 16:16:17 UTC
Created attachment 111475 [details]
libOdbcFb.so 2.0.3.154 64bit

I have tried to unzip the file. Doesn't work in the packing-module for XFCE, but does work with ARK (KDE).
Comment 17 Julien Nabet 2014-12-29 16:48:49 UTC
Thank you Robert for the so file.
I copied it in /usr/lib/x86_64-linux-gnu/odbc/

Badfully I've got only "datasource name not found"
whereas I've created a firebird file with flamerobin in /tmp (because flamerobin uses the user "firebird") and put this in ~.odbc.ini:
[fdo67145]
Description = Firebird
Driver = Firebird
Dbname = localhost:/tmp/testfirebird
User = SYSDBA
Password = 7c9fa145
Role =
CharacterSet =
ReadOnly = No
NoWait = No

I noticed only this console log:
warn:legacy.osl:3273:1:connectivity/source/drivers/odbc/OConnection.cxx:75: Failure from SQLDisconnect

I'm stuck again :-(
Comment 18 Julien Nabet 2014-12-29 16:49:27 UTC
Here's the detailed error message in popup:
SQL Status: IM002
[unixODBC][Driver Manager]Data source name not found, and no default driver specified
Comment 19 Robert Großkopf 2014-12-29 17:08:16 UTC
Hi Julien,

have a look here for a working connection (works only for input values or through Tools → SQL): https://bugs.freedesktop.org/show_bug.cgi?id=67144#c0

I haven't the same system as you, but have copied the lobOdbcFb.so to /usr/lib and also to /usr/lib64.

The driverpath could also be found in the odbcinst.ini.
Don't use the same connection as Flamerobin ...
Comment 20 Julien Nabet 2014-12-29 17:17:21 UTC
(In reply to robert from comment #19)
...
> The driverpath could also be found in the odbcinst.ini.
> Don't use the same connection as Flamerobin ...
I don't understand what you mean. Flamerobin allows me to create a database file. If I don't use SYSDBA, what should I use?
Comment 21 Robert Großkopf 2014-12-29 18:09:02 UTC
(In reply to Julien Nabet from comment #20)
> (In reply to robert from comment #19)
> ...
> > The driverpath could also be found in the odbcinst.ini.
> > Don't use the same connection as Flamerobin ...
> I don't understand what you mean. Flamerobin allows me to create a database
> file. If I don't use SYSDBA, what should I use?

Have never used Flamerobin. The only time I created a Firebird-database was the testdatabase for Base-Handbook. So I created the dabase by isql-fb. I thought the connection in your odbc.ini was created by Flamerobin ...

The Name of the Driver is in Squarebrackets: [Firebird]
This is odbcinst.ini. Only Driver64 is needed ...
[Firebird]
Description		= Firebird ODBC driver
Driver64		= /usr/lib64/libOdbcFb.so

Your Driver64 might be
Driver 64 = /usr/lib/x86_64-linux-gnu/odbc/libOdbcFb.so

Here the odbc.ini for the connection. Driver, Dbname and SensitiveIdentifier is needed, nothing else
[Firebird-libretest]
Description 	= Firebird database libreoffice test
Driver          = Firebird
Dbname          = localhost:libretest.fdb
SensitiveIdentifier = Yes

Your Dbname seems to be wrong:
Dbname = localhost:/tmp/testfirebird
isn't it
Dbname = localhost:/tmp/testfirebird.fdb
?

Regards

Robert
Comment 22 Julien Nabet 2014-12-29 21:49:49 UTC
I had overlooked this part, thank you Robert!
Now I'm able to test :-)
Comment 23 Julien Nabet 2014-12-29 21:56:26 UTC
Created attachment 111491 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce the crash.
Comment 24 Julien Nabet 2014-12-29 22:30:16 UTC
Lionel: I noticed this line in bt:
#11 0x00002aaad160def4 in dbaui::fillTypeInfo (_rxConnection=uno::Reference to (dbaccess::OSharedConnection *) 0x2e34b80, 
    _rsTypeNames="bMLmr||Unknown;Text;Number;Date/Time;Date;Time;Yes/No;Currency;Memo;Counter;Image;Text (fix);Decimal;Binary (fix);Binary;BigInt;Double;Float;Real;Integer;Small Integer;Tiny Integer;SQL Null;Object;Dis"..., _rTypeInfoMap=std::__debug::multimap with 0 elements, _rTypeInfoIters=std::__debug::vector of length 0, capacity 0)
    at /home/julien/compile-libreoffice/libreoffice/dbaccess/source/ui/misc/UITools.cxx:435

So if LO tries to load all the types, including Integer, it may be another dup of fdo#45881, what do you think?
Also, Firebird proposes their odbc-jdbc source here:
http://www.firebirdsql.org/en/odbc-driver/
have you got any contact with a Firebird's dev or would it be interesting someone contact them by referring https://bugs.freedesktop.org/show_bug.cgi?id=45881#c2 ?
Comment 25 Alex Thurgood 2015-01-03 17:40:30 UTC Comment hidden (no-value)
Comment 26 QA Administrators 2016-01-17 20:03:12 UTC Comment hidden (obsolete)
Comment 27 ribotb 2016-01-18 18:00:00 UTC
(In reply to ribotb from comment #1)
> Hi,
> 
> I use Firebird databases with ODBC driver since many versions of LO and i
> never had this problem.
> 
> Actually my version of LO is 4.1.4.1 ans I have no problem.
> 
> 

Still OK with :
Version: 5.1.0.2
Build ID: ecd3574d51754b043f865cf5bafee286d24db7cc
CPU Threads: 2; OS Version: Windows 6.1; UI Render: default; 
Locale : fr-FR (fr_FR)
on Win7/x86
Firebird Database Server 2.5.3.26780

Bernard
Comment 28 Julien Nabet 2016-10-14 18:06:15 UTC
Just for information, there's 2.0.4 version (see http://firebirdsql.org/en/odbc-driver/)
Comment 29 Robert Großkopf 2016-10-21 18:20:48 UTC
Have tried this one again with version 2.0.4.155 64bit from Firebird ODBC. It's a little bit tricky to get it work with LO, but the buggy behavior is the same.

I could create a table through Tools → SQL.
I could input all data through Tools → SQL.

Try this with Firebird - ODBC:
CREATE TABLE "Test" ("ID" INT PRIMARY KEY, "Text" VARCHAR(50));
INSERT INTO "Test" ("ID","Text") VALUES (1,'Nobody');

If I try to create a table through GUI, LO crashes immediately.

If I try to input new values, any value for "ID" seems to be wrong. There seems to be inserted NULL instead of an Integer. I could only use Tools → SQL for input new values for "ID". But this is another bug.

I have tested with LO 5.2.2.2 and OpenSUSE 42.1 64bit rpm Linux, and also with
Version: 5.3.0.0.alpha0+
Build ID: e7324c5705eaa38a2c9aa0636f01a73f033ba4d6
CPU Threads: 4; OS Version: Linux 4.1; UI Render: default; VCL: kde4; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-10-20_06:12:58
Locale: de-DE (de_DE.UTF-8); Calc: group
Comment 30 Julien Nabet 2017-02-19 09:32:41 UTC
Comment on attachment 111491 [details]
bt with debug symbols

This bt is too old to be useful.

Badfully re-reading all this several months later, I don't remember how to reproduce this.
Comment 31 DickStomp 2017-07-10 20:40:47 UTC
Ubuntu 14.04.5 LO5.3.3.2
2 weeks ago: ThinkPad T410; Starting Writer: comes up en goes down
everything tried; system Ubuntu 14.4 reinstall; apt LO5.3.3.2 reinstall; perfect
1 week ago: BioStar; Starting Writer: comes up en goes down
everything tried; system Ubuntu 14.4 reinstall; apt LO5.3.3.2 reinstall; perfect
now: ThinkPad T410: starting Base; attempt start Table New; ABORT; reinstall Base;
starting Base; attempt start Table New; ABORT
Some aborts generates an crash-report to ???
Do I have another time reinstall my ThinkPad T410? It costs five hours waiting...
My two other PC´s, not so much used, are running smoothless at the same DropBox.
Comment 32 DickStomp 2017-07-11 08:21:18 UTC
Ubuntu 14.04.5 LibreOffice 5.3.3.2 ThinkPad T410
Starting Base
Base opens
Load xxx.odb
xxx.odb opens
Click Tables
Base closes immediately without message

Tried:
rename ~/.config/libreoffice/4/user > user-old
restart PC
no good results for Base: same error repeats
Comment 33 Robert Großkopf 2017-07-11 10:40:03 UTC
Please don't set version to the newest version. There is marked: earliest affected version!
Comment 34 DickStomp 2017-07-12 07:12:26 UTC
> Ik heb het Crash-report gelezen, maar het is niet LO die ABEND maar Ubuntu
> 14 die ABORT, op het lezen van een onbestaand mem-address.
Comment 35 DickStomp 2017-07-12 07:26:19 UTC
Each opening of a Base.odb gives a damaged .odb file.
Next approach repairs and by opening it is damaged again.
And so on...
Comment 36 Alex Thurgood 2017-07-12 08:38:36 UTC
(In reply to DickStomp from comment #35)
> Each opening of a Base.odb gives a damaged .odb file.
> Next approach repairs and by opening it is damaged again.
> And so on...

Please check that you've not been hit by the jvmfwk / kernel bug in Ubuntu-based distributions which affects kernel version 4.4.0.81.
Comment 37 Alex Thurgood 2017-07-12 08:41:59 UTC
(In reply to Alex Thurgood from comment #36)

> 
> Please check that you've not been hit by the jvmfwk / kernel bug in
> Ubuntu-based distributions which affects kernel version 4.4.0.81.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1699772
Comment 38 Alex Thurgood 2017-07-12 08:47:42 UTC
(In reply to DickStomp from comment #35)
> Each opening of a Base.odb gives a damaged .odb file.
> Next approach repairs and by opening it is damaged again.
> And so on...

@Dick
What has this got to do with ODBC and Firebird ?
Please be more precise in adding your comments - just saying vaguely that any old random ODB crashes when you try to load it is not what this bug report is about - it is about whether using the 64bit Firebird ODBC driver library causes a Firebird 2.5 ODB (although possibly also a Firebird3 database from comment 29) file to crash LibreOffice...
Comment 39 QA Administrators 2018-07-13 02:41:46 UTC Comment hidden (obsolete)
Comment 40 Julien Nabet 2019-04-21 08:26:19 UTC
Would it be possible to attach a simple fdb file so it helps to reproduce this more easily?
Indeed, I remember having installed a lot of stuff about Firebird and it was still clumsy.
Comment 41 Alex Thurgood 2019-04-21 09:19:51 UTC
@Julien:

Seems that you can get the sample Employee.fdb file with any of the following :

https://pkgs.org/download/firebird3.0-examples

https://ubuntu.pkgs.org/18.04/ubuntu-universe-amd64/firebird3.0-examples_3.0.2.32703.ds4-11ubuntu2_all.deb.html
Comment 42 Alex Thurgood 2019-04-21 09:21:59 UTC
@Julien : unfortunately, if you you are running Debian, it looks like you have to install the server package...
Comment 43 Julien Nabet 2019-04-21 10:06:13 UTC
(In reply to Alex Thurgood from comment #42)
> @Julien : unfortunately, if you you are running Debian, it looks like you
> have to install the server package...

Thank you for your feedback.
I installed firebird3.0-server and firebird3.0-examples
this last one seems to install nothing but finally found an fdb file here:
/home/julien/lo/libreoffice/workdir/UnpackedTarball/firebird/gen/examples/employee.fdb

Since there's no odbc firebird package in Debian repo, I suppose I must download it from Firebird website then must create an  ~/.odbcinst file.
lib odbc64 from https://firebirdsql.org/en/odbc-driver/ has some pb:
"A lone zero block at 2254"

and when I downloaded sources, there's nothing about building (or missed it).
Comment 44 Julien Nabet 2019-04-21 20:02:27 UTC
I finally built the sources by:
- renaming makefile.linux to makefile in Builds/Gcc.lin/ from sources.
- fixed in makefile.environ path of libfbclient.so for FBLIBDIR
- fixed in SetupAttributes.h BUILD_DRIVER_VERSION
#define BUILD_DRIVER_VERSION(major,minor,buildnum) major"."minor"."buildnum
to
#define BUILD_DRIVER_VERSION(major,minor,buildnum) major "." minor "." buildnum
+ retrieved ./Builds/Gcc.lin/Release_x86_64/libOdbcFb.so and place it in a directory

then I created an ~/.odbcinst.ini with:

[ODBC Drivers]
FireBird = installed

[Firebird]
Driver = /home/julien/lo/bugs/Firebird_odbc_205/libOdbcFb.so

+ created an ~/.odbc.ini
[bug_67145]
Description = Firebird
Driver=Firebird
Dbname=127.0.0.1/3050:/home/julien/lo/libreoffice/workdir/UnpackedTarball/firebird/gen/examples/employee.fdb
User=SYSDBA
Password=julien
Role=
CharacterSet=
ReadOnly=No
NoWait=No

I also had to change /etc/firebird/3.0/firebird.conf to replace:
RemoteBindAddress = localhost
by
RemoteBindAddress = 127.0.0.1
+ restarted service
(ipv6 pb?)

Finally, I could create a table with wizard. (created "Tasks" with every default options selected).
But everything is readonly whereas I put "No" to ReadOnly.
So I can't change the structure of a table or put some data.
Comment 45 Robert Großkopf 2020-02-09 15:25:47 UTC
(In reply to Julien Nabet from comment #44)
> 
> + created an ~/.odbc.ini
> [bug_67145]
> Description = Firebird
> Driver=Firebird
> Dbname=127.0.0.1/3050:/home/julien/lo/libreoffice/workdir/UnpackedTarball/
> firebird/gen/examples/employee.fdb
> User=SYSDBA
> Password=julien
> Role=
> CharacterSet=
> ReadOnly=No
> NoWait=No
> 
> Finally, I could create a table with wizard. (created "Tasks" with every
> default options selected).
> But everything is readonly whereas I put "No" to ReadOnly.
> So I can't change the structure of a table or put some data.

You have to add to odbc.ini:
SensitiveIdentifier = Yes

to input values into the tables. 
You didn't test it with a "normal" LO-version, or did I understand it wrong way?
Comment 46 Terrence Enger 2020-02-10 03:24:18 UTC
Created attachment 157760 [details]
gdb backtrace full

I have collected a backtrace from commit 1d7b1a15, configured:
    CCFLAGS=-Wshadow
    --with-jdk-home=/usr/lib/jvm/default-java
    --enable-split-debug
    --enable-gdb-index
    --enable-ld=gold
    --enable-option-checking=fatal
    --enable-dbgutil
    --enable-debug
    --without-system-postgresql
    --without-myspell-dicts
    --with-extra-buildid
    --without-doxygen
    --with-external-tar=/home/terry/lo_hacking/git/src
    --without-package-format
built and running on debian-buster.

My .odb has an ODBC connection to a copy of employee.fdb received with
Firebird within LibreOffice.  The segmentation fault happened as soon
as I tried to right-click > Edit the first table.

I am removing keyword wantBacktrace and adding haveBacktrace.
Comment 47 Julien Nabet 2020-02-10 08:14:57 UTC
On pc Debian x86-64 with master sources updated today, I gave a new try.
This time, I added 
SensitiveIdentifier = Yes
on odbc.ini

I could add a new column in COUNTRY table.

I could also created a table with wizard with by default values.