jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.88k stars 92 forks source link

"Offline" read-only maybe isn't the way to go #301

Open joaquinvacas opened 1 year ago

joaquinvacas commented 1 year ago

Sorry if the title looks like an "order", but let's say I have documents to work with and have no internet connection (maybe a plane), why they can't be stored and synced as soon as internet comes back?

I mean, that's the Windows OneDrive behaviour right now.

Also, thanks for your project, it's amazing.

Wish GNOME's GVFS worked good with OneDrive/Microsoft 365 apps.

jstaf commented 1 year ago

Storing and syncing the changes gets really dicey if there are changes made to the document while you are offline. What happens if you make a bunch of changes on a plane (without internet access), get home and make some changes on a different computer (with internet access), and then turn the original computer (from the plane) back on again the next day? Which changes should we keep? OneDrive doesn't exactly do conflict resolution, one set of changes is going to wipe the other out.

Right now the read-only behavior is the only way I've really thought of that avoids losing user data. (Open to ideas though!)

(Funny that you mention GVFS, I actually wrote this because there was no GVFS support for OneDrive.)

joaquinvacas commented 1 year ago

Didn't thought about this, I'll have to checkout what's the OneDrive's actual behavior.

Somehow, it has to check if the one modified in the plane is older than the modified on the second device with internet access, but don't know, seems to be a little messy for a logical and easy solution. Rename (make a copy)? Replace? Ask user? Whatever.

FerLuisxd commented 1 year ago

I think a way to go is to let the user decide if read-only or not and also prioritize the version to keep with a parameter The default should be the newer file (the one that was edited at last) Really interested in that

abraunegg commented 1 year ago

@FerLuisxd

the one that was edited at last

That may or may not be the right one to keep ... for example performing a 'CTRL-A' to select all then delete then save .... If I only keep that version - if that action was done accidentally ... undesirable data loss would occur.

This is why, for the 'onedrive' client, when there is a conflict locally, the local file is renamed so that the local file is preserved - to allow the user to determine what to keep, what data to keep and to avoid any potential data loss scenarios.

dgtlrift commented 1 year ago

Sounds like version control where if its a simple text file, then a 3-way diff merge could/should handle it, but with Word docs being binary files, this could get intractable - unless OneDrive has a concept to notify accessing apps that the document has changed out from under it and an application level 3-way merge is required.

jstaf commented 1 year ago

Yeah unfortunately there is no way to perform a 3-way merge or rename the local copy because we have no way to tell an app that the file has been modified (or the name has changed) while it is open. Apps like LibreOffice and KeepassXC with special saving behavior are particularly sensitive to this.

This is why, for the 'onedrive' client, when there is a conflict locally, the local file is renamed so that the local file is preserved - to allow the user to determine what to keep, what data to keep and to avoid any potential data loss scenarios.

This can still lead to data loss, as an example: a user is editing a file in LibreOffice that has been changed remotely, saves but does not quit, app does a sync (the local file conflicts with the remote file, so the local file is renamed as part of the sync even though the app doesn't know about it), and then user saves the file again. LibreOffice doesn't know that the local file was renamed, so now it overwrites the changes from the remote that the user never saw. The remote changes have now been wiped by the local version.