realm / realm-core

Core database component for the Realm Mobile Database SDKs
https://realm.io
Apache License 2.0
1.02k stars 165 forks source link

Support FUSE for OS X virtual file systems #1556

Closed jpsim closed 4 years ago

jpsim commented 8 years ago

Cross posting from realm/realm-cocoa#3310, created by @TimOliver:


SimPholders has introduced a feature where if FUSE for OS X is installed on the system, the sandboxed folders for iOS apps in the Simulator will be exposed via a mounted virtual file system volume that shows the folders in a properly organised structure, as opposed to simply opening the folder normally.

Unfortunately, as reported in the Realm Browser repo it appears that Realm Objective-C is unable to open Realm files if they are exposed via this virtual file system. When I attempted to open a Realm file this way, Realm reported an NSError simply stating "Inappropriate file type or format".

Goals

Mounting the contents of an iOS Simulator app via SimPholders + FUSE for OS X, and then opening a Realm file exposed in this virtual file system.

Expected Results

The Realm file opens as normal.

Actual Results

Realm returns an error with the message: "Inappropriate file type or format"

Steps to Reproduce

  1. Download and install FUSE for OS X and (SimPholders)[http://simpholders.com]
  2. After running a Realm-powered app in the Simulator, open SimPholders and click on the app's entry in it. A window representing the virtual folder structure should appear.
  3. Locate any Realm file within this folder structure and attempt to open it (i.e. with the Realm Browser).

    Version of Realm and Tooling

Realm Objective-C 0.98.3

simonask commented 8 years ago

We also have trouble opening Realms on USB devices, and I suspect in both cases it has to do with poor support for mmap() on these devices. Does anything about the error confirm this suspicion?

TimOliver commented 8 years ago

Uh-oh. Yeah, quite potentially.

The original user posted a stack trace that seemed to mention an issue with a mapped file in there.

simonask commented 8 years ago

I tried digging up some information from OSXFUSE, but their mentions of mmap() are precious few. I did find a note in their Changelog from 2004 about removing shared-writable mmap() support because it was causing issues, which would explain this. Still, that's 12 years ago -- does someone perhaps want to get in touch with the OSXFUSE developers and get their input?

TimOliver commented 8 years ago

Yep, I just did some digging on the FUSE GitHub repo and found the same thing. There's also been a few issues opened in the FUSE for OS X repo regarding memory mapping, but most of them have gone un-replied.

Yeah! It sounds like directly contacting the developers about their current position on shared-writable mmap would be a good idea. Apparently they still have a mailing list for FUSE-level issues. Shall I sign up for the mailing list and ask them? Is it just the lack of shared-writable mmap that's causing these issues for us?

jpsim commented 8 years ago

Tim, I wouldn't go too far down that path. FUSE file system support isn't critical to anyone as far as I can't tell. Let's keep the issue open, but I think it's very low priority to pursue this at this point.

simonask commented 8 years ago

Would be great to post these findings on the issue in realm-cocoa, though, in case anyone comes asking for it. :-)

RealmBot commented 4 years ago

➤ Finn Andersen commented:

If we are to support this, it will come out of building more generic support for devices which does not support memory mapping.