pkolaczk / fclones

Efficient Duplicate File Finder
MIT License
1.87k stars 70 forks source link

Optionally skip locking (Deduplicating Google Drive mounted on Mac as smbfs fails) #121

Closed lucbouge closed 2 years ago

lucbouge commented 2 years ago

Dear Piotr,

Thank you very much for your excellent software.

After having used it extensively on my Mac, I tried to used it on my Google Drive repository, which is mounted as a smbfs device. //DRIVE@localhost:58874/Google%20Drive on /Volumes/GoogleDrive (smbfs, nodev, nosuid, nobrowse, mounted by bouge) Unfortunately, fclones remove fails with message fclones: warn: Failed to lock file. I assume it is because smbfs does not implement the locking system call.

Fortunately, fclones move succeeds, but only if moving to a directory which is within the same file system.

Would it be possible to imagine a way to let fclones remove succeed? Maybe adding an option to use a more basic (but somewhat unsafe) locking strategy?

Best regards, Luc.

pkolaczk commented 2 years ago

Sure. I can add option --no-lock to skip locking. Thank you for reporting the issue.

pkolaczk commented 2 years ago

Let me know how it works for you.

pkolaczk commented 2 years ago

I tested it on an smb share, and now with the second commit you don't even need to specify --no-lock - it detects lack of support automatically.

lucbouge commented 2 years ago

I guess it is connected to this question: https://support.google.com/drive/thread/116339014?hl=en

Le 11 mai 2022 à 09:33, Luc Bougé @.***> a écrit :

Dear Piotr,

Thanks for you willingness. Unfortunately, it does not work, yet.

Here is the detailed trace with your original fclones, the one some weeks ago. Here is the trace. Both files contain "123".

If you tell me in which file to act, I can insert tracing nearby the guilty call and show you. It looks like Drive SMB mounting is rather not standard.

pkolaczk commented 2 years ago

Can you paste the trace? Anyway, if the file cannot be removed by standard system utilities, then fclones can hardly do anything about it.

lucbouge commented 2 years ago

I am sorry, I neve used Rust. Could you guide me to genrate the trace?

Le 11 mai 2022 à 12:43, Piotr Kołaczkowski @.***> a écrit :

Can you paste the trace?

pkolaczk commented 2 years ago

Ah, sorry, I misunderstood you've already generated it. What error message do you get then, after the fix?

(You won't get a stacktrace if it is not a crash).

lucbouge commented 2 years ago

% fclones remove <dupes.txt

[2022-05-11 09:14:59.353] fclones: info: Started deduplicating [2022-05-11 09:14:59.359] fclones: warn: Failed to lock file '/Volumes/GoogleDrive/Mon Drive/tmp/b': Operation not supported (os error 45) [2022-05-11 09:14:59.359] fclones: info: Processed 0 files and reclaimed 0 B space

Le 11 mai 2022 à 15:04, Piotr Kołaczkowski @.***> a écrit :

What error message do you get then, after the fix?

pkolaczk commented 2 years ago

And if you append --no-lock ?

pkolaczk commented 2 years ago

And can you try on this branch: handle-unsupported-ops-on-apple (#123), without --no-lock? I think now it should be fine.

lucbouge commented 2 years ago

Sorry, I cloned the regular branch instead of the new one.

With the new one, it works just perfectly.

Thanks!

% ~/tmp/fclones-handle-unsupported-ops-on-apple/target/debug/fclones remove <dupes.txt

[2022-05-11 17:29:12.357] fclones: info: Started deduplicating [2022-05-11 17:29:12.374] fclones: info: Processed 1 files and reclaimed 4 B space

pkolaczk commented 2 years ago

Thanks for confirmation! Merged.