cppcryptfs icon indicating copy to clipboard operation
cppcryptfs copied to clipboard

reproducible lost file case (temporary)

Open Trafo opened this issue 3 years ago • 4 comments

Hi,

I was testing the current main branch and I realized, that I can create a case, which is not so unlikely, which will cause file loss. I did nothing special, used all recommended ways to mount my virtual filesystem.

How you can reproduce it:

  • create an empty folder called A
  • create a folder with files inside of it called B
  • rename A to C
  • rename B to A

The result will be that the files which were part of B and are after the rename part of A, are lost. I think some caching of data will go wrong, but I did not have time to look closer into it. This not happens all the time, in case to try to reproduce it by hand. But with the attached python script it fails in my case 100%. cppcryptobug.zip (Edit: I realized after a while it recovers from it, but took a quiet long time. (some minutes in my case) In a syncing environment that is a problem, because that could already trigger the remotely remove of a file.)

Besides that, the lib lacks supporting ADS (Alternate data streams). Creating, and renaming works, but not in case the object will be moved into or from a directory. For that, this lib already implemented a big workaround, but that is not working, because it tries to create access to the already non-existing src. Not on the local filesystem, but internally inside of caches I assume. This always fails and because of that, the ADS will not be moved with the file. I could fix it, by writing a simple rename ADS workflow, which is doing the trick. If I have time I will create an MR. Besides of that it not supports the ADS moving of directories, in case only one ADS is set. Because the current implementation expects that always the main data stream exists, this is not the case for a directory.

[Edit] Would be nice adding the support of extended attributes. I know it is still not a public API, but it is heavily used by Microsoft and works better than ADS in general. But I guess that I asking for too much.

Trafo avatar Dec 08 '22 05:12 Trafo

Some of my tests did not recover in the time I observe them. (sometimes multiple hours) It seems like, that in case the file structure inside of dir becomes more complex, it took much more time to recover from that.

Trafo avatar Dec 08 '22 06:12 Trafo

I failed to reproduce the file missing problem with that script.

yfdyh000 avatar Dec 09 '22 04:12 yfdyh000

I seem to be able to reproduce this, when I rename folder c to b, then subfolder b is lost GIF 20 05 2023 17-13-42 ` edit: forgot to mention I am using 1.4.3.7, so maybe newer versions are ok edit 2: I cannot reproduce it consistently, unfortunately

neiaberau avatar May 20 '23 15:05 neiaberau

it seems while the directory no longer is shown on the mounted drive, when I check the encrypted files, the directory is still there

neiaberau avatar May 20 '23 16:05 neiaberau