joe42 / CloudFusion

Linux file system (FUSE) to access Dropbox, Sugarsync, Amazon S3, Google Storage, Google Drive or WebDAV servers.
http://joe42.github.com/CloudFusion/
288 stars 35 forks source link

OSXFUSE Bad address #22

Closed jendas1 closed 9 years ago

jendas1 commented 9 years ago

Hello, I am trying to get google drive to work, but the program is always failing here. python main.py --config ~/GDrive.ini ~/folder

  File "/Library/Python/2.7/site-packages/fuse.py", line 414, in _wrapper
      return func(*args, **kwargs) or 0
  File "/Library/Python/2.7/site-packages/fuse.py", line 520, in statfs
      for key, val in attrs.items():
   AttributeError: 'NoneType' object has no attribute 'items'
  mount_osxfusefs: failed to mount /Users/jendas/folder@/dev/osxfuse1: Bad address

I tried almost everything and the error is still here. Strange thing is that the program tries to mount file system even without granted access to my drive (I had in config secret and id). Does anybody know how to solve that problem?

joe42 commented 9 years ago

First of all, I do not have a Mac, so I might not be able to help you, as I am not aware that CloudFusion works on Mac at all. That said, why do you call cloudfusion with python main.py instead of using the documented entry point? If you do not want to install cloudfusion, please use

python -m cloudfusion.main --config cfg.ini mnt

Please supply more information about your error by appending the foreground flag to this command and post the output. Regarding your observation that the file system is mounted anyway; This is expected behavior. The file system is actually mounted first. The configuration happens in the background by copying the supplied configuration file to mnt/config/config. This was done manually in earlier releases of CloudFusion.

jendas1 commented 9 years ago

I have cloudfusion installed, I was just trying to debug the code (that's why I ran main.py). Here is the output with foreground and profile flag.

mount_osxfusefs: failed to mount /Users/jendas/crypt@/dev/osxfuse1: Socket is not connected
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/fuse.py", line 414, in _wrapper
    return func(*args, **kwargs) or 0
  File "/Library/Python/2.7/site-packages/fuse.py", line 520, in statfs
    for key, val in attrs.items():
AttributeError: 'NoneType' object has no attribute 'items'
mount_osxfusefs: failed to mount /Users/jendas/crypt@/dev/osxfuse2: Bad address
Calling ('init', '/')
Calling ('statfs', u'/')
Calling ('destroy', '/')
jendas1 commented 9 years ago

PS: I tried to run developer example with Goole Drive and It worked as expected.

joe42 commented 9 years ago

I removed the profiling output from your post, as this is just for performance analysis. Still, I can't pinpoint your error. My guess is that osxfuse is incompatible with fusepy, which connects CloudFusion with the FUSE layer. That is why you can use the API directly, but can't use the file system.

Could you run:

cloudfusion ~/folder stop
cloudfusion --config ~/GDrive.ini ~/folder foreground

And post the output? In issue #17 , the error message looked different.

jendas1 commented 9 years ago

I took the time and examine each line that was executed. The result is that fuse calls init() then statfs(), where the store is not yet initialized which results into returning none. The None causes the error which results in mount_osxfusefs: failed to mount /Users/jendas/crypt@/dev/osxfuse2: Bad address. This is the problem summed up.

    # line 102 cloudfusion/pyfusebox/configurable_pyfusebox.py
    def statfs(self, path):#add size of vtf
        self.logger.debug("statfs %s", path)
        if self.store_initialized: # in my case is *false*
            path = self.remove_data_folder_prefix(path)
            return super( ConfigurablePyFuseBox, self ).statfs(path)

Can you explain to me how does the authentificaion works? Interestingly when I placed print function inside set configuration it creates a infinite loop.

     #line 47 cloudfusion/main.py
def set_configuration(mountpoint, config_file):
    '''Wait until the file system is mounted, then overwrite the virtual configuration file.
    This will configure Cloudfusion so that it can be used.'''
    virtual_configuration_file = mountpoint+'/config/config'
    while not os.path.exists(virtual_configuration_file):
        print("Waiting") # I got stucked here
        time.sleep(1)
    shutil.copyfile(config_file, virtual_configuration_file)

That probably results because of improper initialisation of TransparentConfigurablePyFuseBox. So the solution is somehow mark store_initialized before the statfs(). Since it can be changed only in write function of virtualconfigfile I must somehow call that before the stastfs(). Here my observation ends, because I don't know the underlying structure of configuration file handling.

   # line 45 cloudfusion/pyfusebox/virtualconfigfile.py
    def write(self, buf, offset):
        written_bytes = super(VirtualConfigFile, self).write(buf, offset)
        if written_bytes >0: # configuration changed
            if not self.pyfusebox.store_initialized:
                self.auto_register()
                self._initialize_store() #this is the only function that changes self.store_initalized in whole program
            else:
                self._reconfigure_store()
        return written_bytes
jendas1 commented 9 years ago

Btw: I tried the loopback example of fusepy and It worked without any problems.

joe42 commented 9 years ago

@jendas1: It would be great if we get this to work.

Btw: I tried the loopback example of fusepy and It worked without any problems.

That seems to be a good sign.

Sorry, but your experiments did not clarify the problems origin. To me it seems like you still execute main.py directly, which is wrong.

To help me get a better understanding of the problem, please reset the repository to the original state, execute the following statements and post the output:

cloudfusion ~/folder stop
cloudfusion --config ~/GDrive.ini ~/folder foreground

You can also add the log flag to the latter command, which will write a more detailed report into the current working directory into a folder called .cloudfusion. But probably the ouput of the command above will suffice.