mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
* sftp: copy only the stored bytes on a non-truncating open A size set by a truncate that grows a file stores nothing, but opening the file for writing without O_TRUNC copied its whole logical size into the temp file as zeros. Copy up to the last stored byte and extend the temp file to the size, which leaves the rest sparse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: upload only up to the written data on close Close streamed the whole temp file, so a hole after the data, from a truncate that grew the file before or during the open, was read back and uploaded as zeros. Track where the copied and written bytes end, upload up to there, and keep the rest as the file's size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: leave the data end alone on an empty write A zero-length WRITE far past the data moved the data end there, so Close uploaded the hole before it as zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: cap what the test filer reads from an upload An upload that wrongly carries a large hole now fails the test instead of filling memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: hash nothing past an out-of-range size A stored size past the largest file offset turned negative and sliced the inline content out of range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: refuse a setstat size past the largest file offset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: fail the hash of an out-of-range size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * sftp: check the size before returning a stored md5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>