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

[BUG] Symlinks don't get updated #246

Closed
OrangeFran opened this issue Dec 1, 2020 · 5 comments
Closed

[BUG] Symlinks don't get updated #246

OrangeFran opened this issue Dec 1, 2020 · 5 comments

Comments

@OrangeFran
Copy link
Contributor

OrangeFran commented Dec 1, 2020

Describe the bug

When symlinking a folder into ~/Dropbox the files get uploaded at first but changes don't get synced.
Normal files work fine, it probably has to do something with the symlink (ln -s).

To Reproduce

Run ln -s /path/to/your/folder ~/Dropbox.
Change a file in /path/to/your/folder.

Expected behaviour

The changed files should sync to the dropbox web service.

System (please complete the following information):

  • Maestral version: 1.2.2
  • OS: MacOS Catalina 10.15.7
  • Desktop environment: ...
  • Qt version: using MacOS app

Additional context

@OrangeFran OrangeFran changed the title [BUG] [BUG] Symlinks don't get updated Dec 1, 2020
@samschott
Copy link
Owner

samschott commented Dec 1, 2020

Yes, that's a know issue. See the disclaimer on symlinks in the wiki: https://github.com/SamSchott/maestral/wiki/Symlinks

The problem is that we don't automatically get file system notifications for changes in symlinked locations. This is a deliberate choice by watchdog, the library that we use to monitor the file system: gorakhargosh/watchdog#365

I could work around this or try to submit a patch upstream but its not trivial. So far, there really has not been any demand.

@OrangeFran
Copy link
Contributor Author

I actually didn't bother with watchdog for now so please excuse me if I'm wrong but I tested this feature with a simple script and it seems that watchdog actually saw the changes.
Heres the script I copied from stackoverflow:

#!/usr/bin/env python3
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler

class MyHandler(FileSystemEventHandler):
    def on_modified(self, event):
        print(f'event type: {event.event_type}  path : {event.src_path}')

if __name__ == "__main__":
    event_handler = MyHandler()
    observer = Observer()
    observer.schedule(event_handler, path='/Users/orangefran/Dev/test', recursive=False)
    observer.start()
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        observer.stop()
    observer.join()

I tested this with a symlink from /Users/orangefran/test to /Users/orangefran/Dev/test and after editing the file I got a notification by watchdog.

@OrangeFran
Copy link
Contributor Author

@samschott Thanks for the link to the wiki. I guess I'll stop using symlinks then. I'm just wondering how dropbox does Desktop and Documents syncing.

@samschott
Copy link
Owner

Hm, not sure why it detects those for you. In my tests, no events where emitted. Watchdog did a complete rewrite of their macOS backend in the last release 0.10.4 which crashes on file-modified events (gorakhargosh/watchdog#702). So Maestral is sticking with watchdog 0.10.3 for now. It's possible however that the behaviour regarding symlinks changed in that release.

Dropbox itself respects only symlinks to other folders inside Dropbox. However, creating such intra-Dropbox symlinks is not supported by the public API. Symlinks pointing outside of the Dropbox folder will be synced as a symlink files instead of being followed: https://help.dropbox.com/installs-integrations/sync-uploads/symlinks

@OrangeFran
Copy link
Contributor Author

I checked and I used 0.10.4 so it could be that.
Anyway, I moved away from symlinks. Thank you for your instant replies and your support.
I guess we can close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants