Here are my observations done so far:
- Initialized Realm database on former Sailfish OS version (4.4) works fine after migration to current release (4.5)
- Re-initialization or installation of a new Realm-based application crashes with “File not found” error
Now what’s crashing it and what file is not found?
I compiled Realm and added debug output to see where the “File not found” is located as the error message shown in logcat
output is misleading in thinking a .cpp
file could not be compiled JIT. It simply shows the source code line number where a std_io error (file not found) was excepted. (see realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp at main · realm/realm-java · GitHub)
This brings in the JNI runtime bindings used by Realm. If a new database is going to be initialized a shared access thread tries to read the database file located inside the appsupport container at
/data/user/0/<name of your APK package>/files/<name of the Realm database file>
(this is the file not found by the initialization shared Realm thread)
This path can be found at the host filesystem here:
[root@Xperia10II-DualSIM user]# pwd
/home/.android/data/user
[root@Xperia10II-DualSIM user]# ls -la
total 20
drwx--x--x 3 501000 appsuppo 4096 Feb 2 16:05 .
drwxrwx--x 46 501000 appsuppo 4096 Jun 11 00:46 ..
drwx------ 2 501000 appsuppo 4096 Feb 2 16:05 0
However the 0
directory is mounted inside the appsupport container from /data/data/
so the host folder shows an empty directory here.
# mount | grep /data
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data/media/0 type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)
/dev/mapper/luks-d60ed9d4-4192-4fcd-af04-b8e9d6f14d0c on /data/user/0 type ext4 (rw,seclabel,noatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user)
That being said it looks like the initialization thread started by Realm JNI is either missing permissions to access the database file or it uses the plain (unmounted) /data/user/0
folder where no files are located.
Why I’m saying this?
Compared to a working Sailfish OS 4.4 appsupport container you’ll see that the /data/user/0
is symlinked to /data/data
.
(Appsupport XA2, SFOS 4.4)
# ls /data/user -la
total 8
drwx--x--x 2 system system 4096 2019-11-29 13:56 .
drwxrwx--x 45 system system 4096 2023-06-14 08:54 ..
lrwxrwxrwx 1 root root 10 2019-11-29 13:56 0 -> /data/data
versus
(Appsupport 10II, SFOS 4.5)
# ls /data/user -la
total 24
drwx--x--x 3 system system 4096 2023-02-02 16:05 .
drwxrwx--x 46 system system 4096 2023-06-11 00:46 ..
drwxrwx--x 73 system system 4096 2023-06-14 08:37 0
I’ve also tried to give full permissions to group and world on the applications data folder but still the file is not found. So in my opinion it has something to do with the mount vs. symlink difference between the new and old appsupport setup.
Cheers,
Nek