[PR #1579] [MERGED] Fixed a bug that filling NULL bytes when changing the attribute after renaming #2056

Closed
opened 2026-03-04 02:03:29 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1579
Author: @ggtakec
Created: 2/19/2021
Status: Merged
Merged: 2/20/2021
Merged by: @gaul

Base: masterHead: fix_1453


📝 Commits (2)

  • 6de31b1 Fixed a bug that filling NULL bytes when changing the attribute after renaming
  • 929f81b Fixed the same bug in chmod/chown/utimens and added tests

📊 Changes

3 files changed (+178 additions, -48 deletions)

View changed files

📝 src/s3fs.cpp (+81 -48)
📝 test/integration-test-main.sh (+87 -0)
📝 test/test-utils.sh (+10 -0)

📄 Description

Relevant Issue (if applicable)

#1453

Details

The rename logic internally copies the file and deletes the original file.
The cause of the #1453 was that s3fs was updating mtime immediately after this copy, at which time a new cache file was created and the contents of the file were null.

In this PR, updates such as mtime are added to the cache file before copying.
And leave the cache file open and copy (put_header).
After copying, rename the cache file and delete the original file.

Keeping the cache file open is necessary because fdcache cannot be renamed unless it is open and new cache files are not created.

And, although it was also the cause of the problem, I accidentally deleted the cache of the destination file.
This is also fixed. (Prevents unnecessary downloads and improves efficiency)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/1579 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 2/19/2021 **Status:** ✅ Merged **Merged:** 2/20/2021 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `fix_1453` --- ### 📝 Commits (2) - [`6de31b1`](https://github.com/s3fs-fuse/s3fs-fuse/commit/6de31b1910bbc00e24e238aab975f77102bc65dc) Fixed a bug that filling NULL bytes when changing the attribute after renaming - [`929f81b`](https://github.com/s3fs-fuse/s3fs-fuse/commit/929f81b6e1e40d32d88a4762fe04b342aaff8045) Fixed the same bug in chmod/chown/utimens and added tests ### 📊 Changes **3 files changed** (+178 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `src/s3fs.cpp` (+81 -48) 📝 `test/integration-test-main.sh` (+87 -0) 📝 `test/test-utils.sh` (+10 -0) </details> ### 📄 Description ## Relevant Issue (if applicable) #1453 ### Details The rename logic internally copies the file and deletes the original file. The cause of the #1453 was that s3fs was updating mtime immediately after this copy, at which time a new cache file was created and the contents of the file were null. In this PR, updates such as mtime are added to the cache file before copying. And leave the cache file open and copy (put_header). After copying, rename the cache file and delete the original file. Keeping the cache file open is necessary because fdcache cannot be renamed unless it is open and new cache files are not created. And, although it was also the cause of the problem, I accidentally deleted the cache of the destination file. This is also fixed. (Prevents unnecessary downloads and improves efficiency) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:03:29 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#2056
No description provided.