Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

whywaita
Copy link

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 whywaita changed the title self.repo.index.remove expect OSError when occured to rename quickly self.repo.index.remove will occur OSError if creating and renaming quickly Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant