Firebird embedded MacOS /tmp with Firebird server running

16 views
Skip to first unread message

Mark Holmes

unread,
Jul 31, 2025, 2:50:27 AMJul 31
to firebird-net-provider
I have a .net 9.0 application which has no problems accessing a Firebird database file in embedded mode as long as the firebird server process is not running. If it is no matter what I do with my configuration the any attempt to connect to the database file will run into a permission error stating that the user is not allowed access to /tmp

My setup for the ADO provider is like this

Environment.SetEnvironmentVariable("FIREBIRD_TMP", appTempDir);
Environment.SetEnvironmentVariable("FIREBIRD_LOCK", appTempDir);

using (var scope = app.Services.CreateScope())
{
    var dbConfig =        scope.ServiceProvider.GetRequiredService<IDatabaseConfigService>();
dbConfig.FirebirdLibraryPath = Path.Combine(AppContext.BaseDirectory, "Firebird-osx-arm64/lib");
dbConfig.ClientLibPath = Path.Combine(dbConfig.FirebirdLibraryPath, "libfbclient.dylib");
dbConfig.CurrentDatabasePath = Global.Settings.ActiveFile;
dbConfig.Csb = new FbConnectionStringBuilder
{
Database = dbConfig.CurrentDatabasePath,
UserID = "sysdba",
Password = "masterkey",
ServerType = FbServerType.Embedded,
ClientLibrary = dbConfig.ClientLibPath,
};

 I also have tried setting the temp directories in the firebird.conf file but as long as the server is up and running it seems to stomp on my configuration. Is the ClientLibrary path to file somehow not being honored here and it's in fact loading the one from the server space? 

Jiří Činčura

unread,
Jul 31, 2025, 6:20:54 AMJul 31
to 'Mr. John' via firebird-net-provider
What is the exact exception?

--
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/

Mark Rotteveel

unread,
Jul 31, 2025, 7:03:48 AMJul 31
to firebird-n...@googlegroups.com
On 31/07/2025 06:28, Mark Holmes wrote:
> I have a .net 9.0 application which has no problems accessing a Firebird
> database file in embedded mode as long as the firebird server process is
> not running. If it is no matter what I do with my configuration the any
> attempt to connect to the database file will run into a permission error
> stating that the user is not allowed access to /tmp
>
> My setup for the ADO provider is like this
[..]
>  I also have tried setting the temp directories in the firebird.conf
> file but as long as the server is up and running it seems to stomp on my
> configuration. Is the ClientLibrary path to file somehow not being
> honored here and it's in fact loading the one from the server space?
At a guess, you need to add your own user to the firebird group, so it
can open files created by the Firebird server process. The "problem" is
that to coordinate certain access (e.g. when opening a database that is
also opened by the server or vice versa) certain memory-mapped temporary
files are used (IIRC).

Mark
--
Mark Rotteveel

Mark Holmes

unread,
Jul 31, 2025, 11:14:15 AMJul 31
to firebird-net-provider
Unhandled exception. FirebirdSql.Data.FirebirdClient.FbException (0x80004005): operating system directive access failed
/tmp/firebird/
 ---> FirebirdSql.Data.Common.IscException: operating system directive access failed
/tmp/firebird/
   at FirebirdSql.Data.Client.Native.StatusVectorHelper.ProcessStatusVector(IntPtr[] statusVector, Charset charset, Action`1 warningMessage)
   at FirebirdSql.Data.Client.Native.FesDatabase.ProcessStatusVector(Charset charset)
   at FirebirdSql.Data.Client.Native.FesDatabase.Attach(DatabaseParameterBufferBase dpb, String database, Byte[] cryptKey)
   at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
   at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect()
   at FirebirdSql.Data.FirebirdClient.FbConnection.Open()
   at Sogic.Core.Common.DatabaseHelper.GetConnection(String filePath) in /Volumes/Repos_APFS/source/electron/sogic-electron-firebird/sogic-core/Common/DatabaseHelper.cs:line 77
   at Program.<Main>$(String[] args) in /Volumes/Repos_APFS/source/electron/sogic-electron-firebird/sogic/Program.cs:line 246
   at Program.<Main>$(String[] args) in /Volumes/Repos_APFS/source/electron/sogic-electron-firebird/sogic/Program.cs:line 264
   at Program.<Main>(String[] args)

Process finished with exit code 134.

I built the app just now to run as a MacOS app store app, meaning that it runs in the application sandbox. Running in this manner the application works as expected even
with Firebird server up and running and it uses my in-app settings for the tmp directories specified in the environment variables. I didn't expect that to work at all but happily it does.

Following Mark Rotteveel's suggestion I added my user name to the firebird group and embedded is now working while i'm developing the application. All is well, thanks everyone for your collective assistance! 

To add your user to the firebird group on a mac: 

sudo dscl . append /Groups/groupname GroupMembership username
Reply all
Reply to author
Forward
0 new messages