mirror of
https://github.com/rclone/rclone.git
synced 2026-10-09 22:45:26 -04:00
vfs: fix reads returning zeros after a file changes during handle caching
When a file was reopened within the --vfs-handle-caching grace period (default 5s) after its remote fingerprint changed - for example after a touch or any other modtime change - _checkObject removed the stale cache file and open recreated an empty one, but nothing sized it. The next GetSize stat'd the empty file and set the item size to 0, so ReadAt's _ensure clamped the request to nothing and skipped the download, then the size check zero-extended the file and returned the zeros. Reads through a mount returned the correct length but zeros for the first read (128 KiB through FUSE). This is easy to hit with git on a --vfs-cache-mode full mount: git freshens pack files with utime, and a concurrent reader then sees "not a GIT packfile". Size the recreated cache file from the object before opening it, as a normal open does.
This commit is contained in:
500 Internal Server Error
Gitea Version: 1.28.0+dev-477-g8b6ad49a5f