Bug 141846 - Firebird 3 - failure to connect to Firebird file - file structure incompatibility on macOS
Summary: Firebird 3 - failure to connect to Firebird file - file structure incompatibi...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.1.2.2 release
Hardware: ARM macOS (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2021-04-23 07:46 UTC by Alex Thurgood
Modified: 2021-09-20 10:29 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Firebird 3 employee database for testing (2.40 MB, application/octet-stream)
2021-07-11 09:55 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thurgood 2021-04-23 07:46:16 UTC
Description:
1) Attempt to create an ODB file using the wizard to connect to an existing Firebird file.

2) Using Firebird server package Firebird-3.0.7-33374-x86_64.pkg.
Point to the example FDB provided in that package 
/Library/Frameworks/Firebird.framework/Versions/A/Resources/examples/empbuild/employee.fdb

3) At the end of the creation wizard, an attempted connection is made to the example FDB file and the main Base window is opened.
 
4) An error message is displayed in the main Base window :

firebird_sdbc error:
*unsupported on-disk structure for file /Library/Frameworks/Firebird.framework/Versions/A/Resources/examples/empbuild/employee.fdb; found 12.2, support 12.0
caused by
'isc_attach_database'

No further work is possible.

So LO doesn't support the current iteration of Firebird server ?

Why is the version number hardcoded in our code ?
  

Steps to Reproduce:
See above

Actual Results:
No connection possible to current release of Firebird server produced FDB file

Expected Results:
The connection should be established and the data structure of the schema read, in order to load the corresponding db object.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
TDF LO

Version: 7.1.2.2 / LibreOffice Community
Build ID: 8a45595d069ef5570103caea1b71cc9d82b2aae4
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 1 Robert Großkopf 2021-05-14 15:30:50 UTC
Tested it with LO 7.1.3.2 on OpenSUSE 15.2 64bit rpm Linux.
Could connect to the database employee.fdb of Firebird-3.0.7-33374 without any problems. 
First I don't recognize the file is only readable after extraction of the package, but then it worked.
So I couldnt find any buggy behavior here on Linux.
Comment 2 Alex Thurgood 2021-05-19 13:47:58 UTC
(In reply to Robert Großkopf from comment #1)
> Tested it with LO 7.1.3.2 on OpenSUSE 15.2 64bit rpm Linux.
> Could connect to the database employee.fdb of Firebird-3.0.7-33374 without
> any problems. 
> First I don't recognize the file is only readable after extraction of the
> package, but then it worked.
> So I couldnt find any buggy behavior here on Linux.

Thanks Robert,
I'm guessing that this is a macOS issue.
Comment 3 Alex Thurgood 2021-07-09 12:43:17 UTC
Bug still present in 

Collabora Office 
Version: 21.06.3.1
Build ID: af9fc08c876737f17aed2427c2645ca8b82fdaf9
CPU threads: 8; OS: Mac OS X 11.4; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded


AND


Different error message in LibreOffice Vanilla
Version: 7.1.4.2 / LibreOffice Community
Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
CPU threads: 8; OS: Mac OS X 11.4; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded


firebird_sdbc error:
*I/O error during "open O_CREAT" operation for file "/Users/alex/Downloads/employee.fdb"
*Error while trying to create file
*File exists
caused by
'isc_create_database'


AND

LibreOffice 
Version: 7.1.4.2 / LibreOffice Community
Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
CPU threads: 8; OS: Mac OS X 10.16; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded

firebird_sdbc error:
*unsupported on-disk structure for file /Users/alex/Downloads/employee.fdb; found 12.2, support 12.0
caused by
'isc_attach_database'
Comment 4 jcsanz 2021-07-11 09:30:26 UTC
Bug also present in:

Version: 7.1.4.1 (x64) / LibreOffice Community
Build ID: f67b1ddedeb24fca1c5938e7cebfab73d708b35b
CPU threads: 2; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: es-ES
Calc: threaded

Firebird server version: WI-V4.0.0.2496 fIREBIRD 4.0

Error Message:
firebird_sdbc error:
*unsupported on-disk structure for file C:\PROGRAM FILES\FIREBIRD\FIREBIRD_4_0\EXAMPLES\EMPBUILD\EMPLOYEE.FDB; found 13.0, support 12.0
caused by
'isc_attach_database'
Comment 5 Robert Großkopf 2021-07-11 09:50:36 UTC
(In reply to juancsanzc from comment #4)
> Bug also present in:
> 
> Version: 7.1.4.1 (x64) / LibreOffice Community
> Build ID: f67b1ddedeb24fca1c5938e7cebfab73d708b35b
> CPU threads: 2; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL:
> win
> Locale: es-ES (es_ES); UI: es-ES
> Calc: threaded
> 
> Firebird server version: WI-V4.0.0.2496 fIREBIRD 4.0
> 
> Error Message:
> firebird_sdbc error:
> *unsupported on-disk structure for file C:\PROGRAM
> FILES\FIREBIRD\FIREBIRD_4_0\EXAMPLES\EMPBUILD\EMPLOYEE.FDB; found 13.0,
> support 12.0
> caused by
> 'isc_attach_database'

You are using the example, which comes with Firebird 4. This will give the same error here on OpenSUSE 15.2. But the bug is reported for Firebird 3 (and also the employee.fdb of Firebird 3)
Comment 6 Robert Großkopf 2021-07-11 09:55:54 UTC
Created attachment 173490 [details]
Firebird 3 employee database for testing
Comment 7 jcsanz 2021-07-11 16:16:17 UTC
 
> You are using the example, which comes with Firebird 4. This will give the
> same error here on OpenSUSE 15.2. But the bug is reported for Firebird 3
> (and also the employee.fdb of Firebird 3)

Yes, that's right, I was using a Firebir 4, but the error is the same if I use your sample database.

On the other hand, I think I found the error:
If I use the wizard to connect, and I browse to find the file, I obtain a full path like "file:///C:/Users/jc/BD/employee_FB3.fdb", that produce the error.
But if I delete one slash after "file:" so the path is "file://C:/Users/jc/BD/employee_FB3.fdb", I can connect
Comment 8 Robert Großkopf 2021-07-11 16:30:58 UTC
(In reply to juancsanzc from comment #7)
>  
> > You are using the example, which comes with Firebird 4. This will give the
> > same error here on OpenSUSE 15.2. But the bug is reported for Firebird 3
> > (and also the employee.fdb of Firebird 3)
> 
> Yes, that's right, I was using a Firebir 4, but the error is the same if I
> use your sample database.

Really the same with "found 13.0, support 12.0"?

> 
> On the other hand, I think I found the error:
> If I use the wizard to connect, and I browse to find the file, I obtain a
> full path like "file:///C:/Users/jc/BD/employee_FB3.fdb", that produce the
> error.
> But if I delete one slash after "file:" so the path is
> "file://C:/Users/jc/BD/employee_FB3.fdb", I can connect

So connection is working with FB3, isn't it? 
I have thought the first path would be the right, but I have no Windows to test. So we should have a look at the connection-string for Windows.
Comment 9 jcsanz 2021-07-11 17:06:40 UTC
(In reply to Robert Großkopf from comment #8)
> (In reply to juancsanzc from comment #7)
> >  
> > > You are using the example, which comes with Firebird 4. This will give the
> > > same error here on OpenSUSE 15.2. But the bug is reported for Firebird 3
> > > (and also the employee.fdb of Firebird 3)
> > 
> > Yes, that's right, I was using a Firebir 4, but the error is the same if I
> > use your sample database.
> 
> Really the same with "found 13.0, support 12.0"?
> 
> > 
> > On the other hand, I think I found the error:
> > If I use the wizard to connect, and I browse to find the file, I obtain a
> > full path like "file:///C:/Users/jc/BD/employee_FB3.fdb", that produce the
> > error.
> > But if I delete one slash after "file:" so the path is
> > "file://C:/Users/jc/BD/employee_FB3.fdb", I can connect
> 
> So connection is working with FB3, isn't it? 
> I have thought the first path would be the right, but I have no Windows to
> test. So we should have a look at the connection-string for Windows.

No, sorry, I´ve explained it badly and may be differen error.
If I use the wizard to connect to a file:
1 Open Base
2 Select connect to an existing database
3 Select Firebird file
4 Select Browse button
5 Browse to the file an obtain a ¿url? like "file:///C:/Users/jc/BD/employee_FB3.fdb"
6 Clic Finish
7 Save the odb file
8 I obtain the error "firebird_sdbc error:
*Unable to complete network request to host "servidor1".
*Failed to locate host machine.
*The specified name was not found in the hosts file or Domain Name Services.
caused by
'isc_attach_database'

But if in step 5 I change the url to "file://C:/Users/jc/BD/employee_FB3.fdb" (with two slashes after file:) I can connect succesfully
Comment 10 Robert Großkopf 2021-07-11 17:38:15 UTC
(In reply to juancsanzc from comment #9)
> 
> But if in step 5 I change the url to
> "file://C:/Users/jc/BD/employee_FB3.fdb" (with two slashes after file:) I
> can connect succesfully

This is bug 115547
Comment 11 Alex Thurgood 2021-07-12 07:45:24 UTC
Yes, the path construction error is a relatively old and known bug on Windows, which has nothing to do with the FB engine version support.

Neither FB4, which has a 13.0 engine disk structure, nor currently released versions of FB3 > 12.0 are supported by LO.


Basically, the following commits need to be reworked to take account of current Firebird releases :

https://cgit.freedesktop.org/libreoffice/core/commit/?id=45f42681f4d1260c42140a313560534e605f81a4
Comment 12 Julien Nabet 2021-09-19 10:16:34 UTC
Now that tdf#115547 is fixed (from next releases 7.2.2/7.1.7), does it change something or is it still exactly the same error?
Comment 13 Mike Kaganski 2021-09-19 10:50:14 UTC
Firebird itself does not support older on-disk structures (ODS). This is true both for version 3 [1], and version 4 [2]. (Release notes for v4 do mention a hack to support ODSv12 by copying a library from older version to /plugins; while it could in theory be made for Windows, it's likely totally impossible for Linux, where we rely on system FB, and thus custom (self-built?) library for FB3.0 could fail to work with system FB4.0.)

The 12 vs 12.2 change was described in FB 3.0.4 release notes [3]. It is described to have impact on macOS and 32-bit Linux; and note this excerpt:

> Existing databases ... are always opened successfully with Firebird 3.0.4
> on the platform *where they were initially created*

The overall policy of the project seems to require use of backup-move-restore procedure whenever you want to move a BD to a different system; LibreOffice embedded engine itself save the backup of the FDB, not the FDB itself, for that reason. By the way, IIRC the ODS even of the same version will differ on Big-Endian vs Little-Endian machines, making direct move of a FDB of the same ODS version impossible.

And hence I consider this issue to be NOTABUG (assuming that it was a user error not using the proper procedure when moving the database), or NOTOURBUG (taking into account the phrase "A legacy provider for databases with ODS 8 to 11.2 is planned for a future sub-release" from 3.0 release notes, which is curiously absent from 4.0 release notes).

[1] https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html#_other_providers
[2] https://firebirdsql.org/file/documentation/release_notes/html/en/4_0/rlsnotes40.html#rnfb40-general
[3] https://firebirdsql.org/file/documentation/release_notes/html/en/3_0/rlsnotes30.html#rnfb30-apiods-ods-12-2
Comment 14 Mike Kaganski 2021-09-19 11:02:00 UTC
(In reply to Alex Thurgood from comment #0)
> firebird_sdbc error:
> *unsupported on-disk structure for file
> /Library/Frameworks/Firebird.framework/Versions/A/Resources/examples/
> empbuild/employee.fdb; found 12.2, support 12.0
> caused by
> 'isc_attach_database'

By the way, since LO 7.2, where FB was upgraded from 3.0.0 to 3.0.7 [1], the ODS 12.2 (from 3.0.4) should be supported on macOS, but then 12.0 would be unsupported, for the reasons described in comment 13.

[1] https://gerrit.libreoffice.org/c/core/+/105440
Comment 15 Mike Kaganski 2021-09-19 12:04:42 UTC
(In reply to Mike Kaganski from comment #14)
> since LO 7.2, where FB was upgraded from 3.0.0 to 3.0.7 [1], the
> ODS 12.2 (from 3.0.4) should be supported

So resolved fixed by the mentioned commit.

The problem related to support of ODSv13 (i.e., upgrading embedded Firebird engine to v4) needs a separate issue, with its own regressions ;)
Comment 16 Alex Thurgood 2021-09-20 10:03:55 UTC
(In reply to Mike Kaganski from comment #13)

 
> The overall policy of the project seems to require use of
> backup-move-restore procedure whenever you want to move a BD to a different
> system; LibreOffice embedded engine itself save the backup of the FDB, not
> the FDB itself, for that reason. By the way, IIRC the ODS even of the same
> version will differ on Big-Endian vs Little-Endian machines, making direct
> move of a FDB of the same ODS version impossible.
> 


This is hugely awkward for cross-platform compatibility with regard to the project's choice of embedded database which is slated to become the default.

If I've understood your big/little endian comment, it basically means that in an enterprise setting, or for an association or club, that it will be impossible to have one single ODB file covering all OS arch.
Comment 17 Alex Thurgood 2021-09-20 10:04:48 UTC
(In reply to Mike Kaganski from comment #15)
> (In reply to Mike Kaganski from comment #14)
> > since LO 7.2, where FB was upgraded from 3.0.0 to 3.0.7 [1], the
> > ODS 12.2 (from 3.0.4) should be supported
> 
> So resolved fixed by the mentioned commit.


Thanks for doing this !
Comment 18 Alex Thurgood 2021-09-20 10:15:02 UTC
Confirmed fixed when testing with

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 8; OS: Mac OS X 11.5.2; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 19 Alex Thurgood 2021-09-20 10:18:25 UTC
Also verified fixed in 

Version: 7.2.1.2 / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 8; OS: Mac OS X 11.5.2; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded





Unfortunately, still not fixed however in

Collabora Office
Version: 21.06.4.1
Build ID: 5ad6bfb54ffec15fe311ed990aa1518979b8f086
CPU threads: 8; OS: Mac OS X 11.5.2; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: threaded
Comment 20 Mike Kaganski 2021-09-20 10:29:29 UTC
(In reply to Alex Thurgood from comment #16)
> If I've understood your big/little endian comment, it basically means that
> in an enterprise setting, or for an association or club, that it will be
> impossible to have one single ODB file covering all OS arch.

As said, LibreOffice's embedded DB stores a *backup*, not the FDB itself. And the backups are platform-independent; that means that ODBs with embedded databases *are* cross-platform: on any platform, LibreOffice first expands the internal FBK to an FDB native for current host, then works with it, and finally backs up the end result and stores the new FBK into ODB, ready for work on any other system.

Also working with a FB server would ne problem-free: the server runs on its platform, and connecting to if from anywhere is OK (just not implemented using our SDBC driver yet).

What would be (expectedly) problematic is working with a separate FDB ("connect to existing Firebird file"): the FDBs are platform- and version-specific.