[MacRuby] #922: Writing a MacFUSE fs doesn't work when delegating methods
#922: Writing a MacFUSE fs doesn't work when delegating methods ------------------------------+--------------------------------------------- Reporter: kourge@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- I tried implementing a simple HelloFS on MacFUSE through MacRuby by referring to the [http://code.google.com/p/macfuse/source/browse/trunk /filesystems-objc/HelloFS/HelloFuseFileSystem.m HelloFuseFileSystem.m] sample. (See hellofs_working.rb) However, if the necessary methods delegate the response of another method on self, MacRuby aborts. (See hellofs.rb) This seems to occur in both 0.5 (on Leopard) and 0.6 (on Snow Leopard). -- Ticket URL: <http://www.macruby.org/trac/ticket/922> MacRuby <http://macruby.org/>
#922: Writing a MacFUSE fs doesn't work when delegating methods ------------------------------+--------------------------------------------- Reporter: kourge@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: MacRuby 0.7 Component: MacRuby | Keywords: ------------------------------+--------------------------------------------- Comment(by kourge@…): Please disregard hellofs_working.2.rb; I accidentally attached hellofs_working.rb twice. -- Ticket URL: <http://www.macruby.org/trac/ticket/922#comment:1> MacRuby <http://macruby.org/>
#922: Writing a MacFUSE fs doesn't work when delegating methods ------------------------------+--------------------------------------------- Reporter: kourge@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.8 Component: MacRuby | Resolution: fixed Keywords: | ------------------------------+--------------------------------------------- Changes (by eloy.de.enige@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 0.7 => MacRuby 0.8 Comment: This works on trunk: {{{ framework 'cocoa' framework 'macfuse' class Exception def to_ns(domain='', code=self.hash) user_info = { 'NSLocalizedDescriptionKey' => self.message, 'Backtrace' => self.backtrace } NSError.errorWithDomain(domain, code: code, userInfo: user_info) end end class HelloFS PATH = '/hello.txt' def contents(path) [PATH.lastPathComponent] end def read_file(path) return nil unless path == PATH "Hello, World!\n" end def size(path) read_file(path).size end def file?(path) path == '/hello.txt' end def contentsOfDirectoryAtPath(path, error: error) self.contents(path) rescue Exception => e error[0] = e.to_ns('GMUserFileSystemDomain') nil end def contentsAtPath(path) self.read_file(path).dataUsingEncoding(NSUTF8StringEncoding) end end d = HelloFS.new fs = GMUserFileSystem.alloc.initWithDelegate(d, isThreadSafe: true) fs.mountAtPath("/Volumes/Hello", withOptions: ['rdonly', 'volname=HelloFS']) sleep 1 puts `ls /Volumes/Hello` puts `cat /Volumes/Hello/hello.txt` fs.unmount }}} Outputs: {{{ macruby(869,0x103f44000) malloc: *** auto malloc[869]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug. macruby(869,0x103fc7000) malloc: *** auto malloc[869]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug. hello.txt Hello, World! macruby@fuse0 unmount from /Volumes/Hello }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/922#comment:3> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby