Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote Config does not work with custom SQLite3 libraries #10884

Closed
aaron-foreflight opened this issue Mar 2, 2023 · 7 comments
Closed

Remote Config does not work with custom SQLite3 libraries #10884

aaron-foreflight opened this issue Mar 2, 2023 · 7 comments

Comments

@aaron-foreflight
Copy link

aaron-foreflight commented Mar 2, 2023

Description

Currently SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION is passed to sqlite3_open_v2(...) in - (void)createOrOpenDatabase in RCNConfigDBManager.m.

If an app eschews the standard Apple sqlite3 library shipped on iOS and uses their own custom sqlite3 build with source directly from the SQLite3 repo, the SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION flag does not exist as Apple has only implemented this in their version of sqlite3 and not contributed it back to the main repo.

We cannot use the Apple's sqlite3 implementation as we need additional spatial querying capabilities built into the library for our application. It would be useful if Remote Config checked if the flag exists before using it.

e.g.:

#ifdef SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION
    int flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE |
                SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION |
                SQLITE_OPEN_FULLMUTEX;

#else
    int flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE |
                SQLITE_OPEN_FULLMUTEX;
#endif

Reproducing the issue

No response

Firebase SDK Version

10.6.0

Xcode Version

14.2.0

Installation Method

Swift Package Manager

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@paulb777
Copy link
Member

paulb777 commented Mar 2, 2023

Thanks for the report. I'm not sure that the suggested change would redirect the Remote Configuration to point to alternative headers for the sqlite3. Also, there may be other issues since we only test with the system sqlite3.

@aaron-foreflight
Copy link
Author

aaron-foreflight commented Mar 2, 2023

In the context of Package.swift builds, It does indeed look for other headers because there is nothing in the linkerSettings for sqlite3 on that target. I verified that my headers were used in my local fork of Firebase by using a symbol only available from my sqlite3 package. I do realize that this does not apply to any of the other build systems you support.

I can continue with my fork, but I thought I would point this out as it is a blocker for Firebase adoption for anyone doing spatialite and geos stuff with iOS, and probably many other applications that require sqlite features not in Apples platform build.

@paulb777
Copy link
Member

paulb777 commented Mar 2, 2023

Thanks. We may want to consider an alternative to sqlite3 for the Remote Config implementation.

@cprince-foreflight
Copy link
Contributor

Any update here? It's been a year.

@morganchen12
Copy link
Contributor

We do not have plans to allocate dev time to make this change. Would you be willing to contribute a patch based on the code posted by Aaron above?

@ncooke3
Copy link
Member

ncooke3 commented Apr 22, 2024

Closed via #12548. Thanks, @cprince-foreflight, for the fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.