gitfs icon indicating copy to clipboard operation
gitfs copied to clipboard

self.repo.index.remove will occur OSError if creating and renaming quickly

Open whywaita opened this issue 3 years ago • 0 comments

self.repo.index.remove remove an old file when renaming the file.

gitfs will execute Rename first if creating and renaming while waiting for a commit. Then gitfs not execute Create and occurred OSError.

This change caught OSError when renaming and not committed the old file.

Reproduce steps

  1. Check a new file by gitfs, but not found
  2. Create a new file (A) by hand or software
  3. Rename a file (A to B) by hand or software
  4. Check a new file by gitfs. gitfs found rename (A to B)
  5. gitfs execute self.repo.index.remove(), it will be removed A. But self.repo not registered A. Then gitfs occurred OSError.

Usecases

it that creating and renaming is very quickly in some storage software. for example, a file of user-uploaded put to a sandbox to check vulnerability, file name, and more.

It renames the uploaded file after check.

whywaita avatar Jun 13 '21 21:06 whywaita