cryptomator icon indicating copy to clipboard operation
cryptomator copied to clipboard

File Corruption with Microsoft Office and Dropbox

Open QriMi opened this issue 2 years ago • 20 comments

Please agree to the following

Summary

The original file is deleted and replaced by one or more .tmp files

What software is involved?

  • Operating System: Windows 11 Pro 22H2 22621.2283
  • Cryptomator: 1.10.0
  • Microsoft 365 MSO (Version 2308 Build 16.0.16731.20182) 64 bits
  • Dropbox v 182.4.6427

Volume Type

WinFsp / WinFsp (Local Drive)

Steps to Reproduce

  1. Open a file with Microsoft Word or Excel
  2. Modify it then click on save

Expected Behavior

Save file changes without corruption

Actual Behavior

Error is displayed. Original file is deleted and replaced by a file of type 1234ABCD.tmp

Reproducibility

Random

Relevant Log Output

No response

Anything else?

Animation

Without dropbox it works fine.

QriMi avatar Mar 04 '23 13:03 QriMi

I cannot reproduce this with Microsoft 365 (MSO (Version 2302 Build 16.0.16130.20186) 64 Bit) and files-online-only turned off.

@QriMi Are you using Dropbbox files-online-only feature?

infeo avatar Mar 06 '23 16:03 infeo

@infeo No I don't use the Dropbbox files-online-only feature. I just tried it with Microsoft 365 MSO (Version 2302 Build 16.0.16130.20186) 64 Bits and the bug is still present but behaves differently on this version :

  1. Open a .xlsx file with Microsoft Excel
  2. Click several times on save (with or without modification)

Result : creation of one or more .tmp files with or without Error.

Also impossible to create and save a new document in either Excel or Word.

Only on WinFsp / WinFsp (Local Drive) apparently.

QriMi avatar Mar 07 '23 07:03 QriMi

@QriMi We released Cryptomator 1.7.3 this week which contains an important fix for reading content from the vault. Is this issue still reproducable?

infeo avatar Mar 17 '23 13:03 infeo

@infeo Yes, the problem is always present in WinFsp / WinFsp (Local Drive) only, i have updated the post.

QriMi avatar Mar 18 '23 10:03 QriMi

@QriMi When you open a Windows cmd shell and enter

wmic useraccount where name='%username%' get sid`

does the output start with S-1-12-1-... ?

infeo avatar Mar 20 '23 16:03 infeo

@infeo No, start with S-1-5-21-...

QriMi avatar Mar 21 '23 10:03 QriMi

@QriMi you closed the issue, is this solved for you?

hpvd avatar Mar 21 '23 10:03 hpvd

@hpvd no sorry

QriMi avatar Mar 21 '23 10:03 QriMi

Without dropbox it works fine.

does it "always" works fine with dropbox and without cryptomator (storing directly in a subfolder of dropbox, without encryption)?

Background: I see a somehow similar, not identical problem from time to time too - but when not using cryptomator with dropbox, but old boxcryptor classic with dropbox, and I was thinking about moving to cryptomator... (which I'm already using for non-daily- working directories)

hpvd avatar Mar 21 '23 12:03 hpvd

No problem with Microsoft Office and Dropbox only. The problem seems to occur because Microsoft Office creates a temporary file when editing a document, a temporary solution is to edit your documents with another software or to disable Dropbox synchronization and manually synchronize later.

QriMi avatar Mar 22 '23 07:03 QriMi

Same behavior for me since I upgraded to Cryptomator 1.73 and WinFSP 2023 2.0.23075. I killed an existing Excel Macro file after I tried to save changes, which was denied with an error message. I closed Excel and lost the whole file and was only able to recover it with the help of Dropbox file history, so this is a very critical bug!

Then I tried to save a new Excel or Word file to the vault, which doesn't work anymore at all.

DavidUniUlm avatar Mar 27 '23 12:03 DavidUniUlm

@DavidUniUlm Cryptomator only supports the WinFsp version, which is shipped with the EXE installer. For 1.7.3 it ist WinFsp 2022 1.12.22339.

@QriMi Thanks for the output. WinFsp also ships with a tool to determine the used userid. Can you open a terminal, execute the following command and report the output?

C:\Users\JimDonut>"C:\Program Files (x86)\WinFsp\bin\fsptool-x64.exe" id

Output on my machine is

User=S-1-5-21-1806044646-....(MyComputer\JimDonut) (uid=197613)
Owner=S-1-5-21-1806044646-...(MyComputer\JimDonut) (uid=197613)
Group=S-1-5-21-1806044646-...(MyComputer\JimDonut) (gid=197121)
`` 

infeo avatar Mar 27 '23 13:03 infeo

@infeo

User=S-1-5-21-501063397-....(DESKTOP\Qrimi) (uid=197609)
Owner=S-1-5-21-501063397-...(DESKTOP\Qrimi) (uid=197609)
Group=S-1-5-21-501063397-...(DESKTOP\Aucun) (gid=197121)

QriMi avatar Mar 27 '23 14:03 QriMi

I just upgraded from WinFsp 2022 1.12.22339 to see if anything changed. Switched back and nothing changed.

Output for me is

User=S-1-5-21-2576235843-....(DESKTOP-5600X\David) (uid=197609)
Owner=S-1-5-21-2576235843-....(DESKTOP-5600X\David) (uid=197609)
Group=S-1-5-21-2576235843-....(DESKTOP-5600X\Kein) (gid=197121)

DavidUniUlm avatar Mar 27 '23 14:03 DavidUniUlm

Thanks for the feedback.

Modifying and saving the changes in a rapid sequences triggered the bug also on my test device. I don't believe anymore, that this is related to permissions. Need to investigate further.

infeo avatar Mar 28 '23 10:03 infeo

Yes i am facing same issue. It i save excel file rapidly twice. Issue always appear and easily reproduce-able.

hassanrazakhalid avatar Aug 08 '23 19:08 hassanrazakhalid

Can you outline the steps you do to force the corruption with Excel? I've tried Cryptomator 1.9.3 and can't force any corruption by saving quickly.

CM: v1.9.3 OS: Windows 11 Office: 2019 Mount: WinFSP (Local)

a-528 avatar Sep 09 '23 15:09 a-528

@a-528 Thanks for mentioning it. We have a different ticket reporting the problem with the combo of Winfsp+Dropbox+Office (see https://github.com/cryptomator/cryptomator/issues/2880), but i also can't redproduce it anymore with Winfsp(Local Drive).

@QriMi Is this still happening when you select Winfsp (Local Drive)? Please note that you have to lock open vaults and unlock them again if you change the volume type.

infeo avatar Sep 11 '23 07:09 infeo

Hello, yes bug always present with an updated system in Winfsp (Local Drive).

QriMi avatar Sep 14 '23 13:09 QriMi

This problem still persists. Microsoft Office programs lock Read and Write when a file is opened in Word of Excel. When a file is unsaved, MS Office stores the file as .tmp file and then renames the file to .xls .doc after saving. The read and write lock seems to conflict with Cryptomator and results in Microsoft Office UNABLE to save the file. The result is an empty file with the name, but the size of zero bytes. The error output is:

0:07:27.469 [Thread-28] ERROR o.c.frontend.fuse.ReadWriteAdapter - unlink /Office_File.docx failed. java.nio.file.FileSystemException: C:\Dropbox\Office_File.docx: The process cannot access the file because it is being used by another process at java.base/sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source) at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source) at java.base/java.nio.file.Files.deleteIfExists(Unknown Source) at [email protected]/org.cryptomator.cryptofs.common.DeletingFileVisitor.forceDeleteIfExists(DeletingFileVisitor.java:68) at [email protected]/org.cryptomator.cryptofs.common.DeletingFileVisitor.visitFile(DeletingFileVisitor.java:51) at [email protected]/org.cryptomator.cryptofs.common.DeletingFileVisitor.visitFile(DeletingFileVisitor.java:31) at java.base/java.nio.file.Files.walkFileTree(Unknown Source) at java.base/java.nio.file.Files.walkFileTree(Unknown Source) at [email protected]/org.cryptomator.cryptofs.CryptoFileSystemImpl.deleteFileOrSymlink(CryptoFileSystemImpl.java:431) at [email protected]/org.cryptomator.cryptofs.CryptoFileSystemImpl.delete(CryptoFileSystemImpl.java:425) at [email protected]/org.cryptomator.cryptofs.CryptoFileSystemProvider.delete(CryptoFileSystemProvider.java:241) at java.base/java.nio.file.Files.delete(Unknown Source) at [email protected]/org.cryptomator.frontend.fuse.ReadWriteAdapter.unlink(ReadWriteAdapter.java:226) at [email protected]/org.cryptomator.jfuse.api.FuseOperationsDecorator.unlink(FuseOperationsDecorator.java:72) at [email protected]/org.cryptomator.jfuse.win.FuseImpl.unlink(FuseImpl.java:273) 20:07:28.320 [Thread-26] WARN o.c.frontend.fuse.ReadWriteAdapter - Setting posix permissions not supported by underlying file system. 20:07:28.326 [Thread-24] WARN o.c.frontend.fuse.ReadWriteAdapter - Setting posix permissions not supported by underlying file system. 20:18:09.544 [Thread-25] WARN o.c.frontend.fuse.ReadWriteAdapter - Setting posix permissions not supported by underlying file system. 20:18:09.561 [Thread-25] ERROR o.c.frontend.fuse.ReadOnlyAdapter - rename /444BDB4B.tmp -> /Office_File.xls failed.

This is a huge issue and makes Cryptomator unusable for office work. Please find a solution!

jacklki avatar May 01 '24 08:05 jacklki

@jacklki Your issue is different, see #2880.

infeo avatar May 13 '24 08:05 infeo

I just noticed we have a second ticket for this. Closing this in favor of https://github.com/cryptomator/cryptomator/issues/2880

infeo avatar May 13 '24 08:05 infeo