[PR #1954] [MERGED] Fixed a bug could not change the mode while the file was opened #2273

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

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1954
Author: @ggtakec
Created: 5/29/2022
Status: Merged
Merged: 6/12/2022
Merged by: @gaul

Base: masterHead: fix_opened_chmod


📝 Commits (1)

  • 5e0640d Fixed a bug could not change the mode while the file was opened

📊 Changes

2 files changed (+37 additions, -0 deletions)

View changed files

📝 src/cache.cpp (+6 -0)
📝 test/integration-test-main.sh (+31 -0)

📄 Description

Relevant Issue (if applicable)

#1947

Details

When using the --in-place(-c) option of the sed command, sed seems to behave as follows:

  • Create a new temporary file(create the file mode as a 0000)
  • Read the original file and write the replacement result to the temporary file
  • Changed temporary file mode to 0644
  • Close file, and replace file

In s3fs, the stat information of a file is internally cached until flush is executed, during the file is opened.
In sed --in-place mode, a Permission denied(EACCESS) error occurred because s3fs forgot to update the open file mode to the stat cache.
So this PR fixed this bug.

NOTE

This PR added a test case.
Added test case was implemented with the sed command.
I made a shell script and a simple C test code and tried bug reproduction, but I couldn't reproduce the same error.
So the test is implemented with the sed command.

And in addition to the file mode, the file owner and group cache may also change, but I couldn't find a pattern that would cause an error while doing these things.
Therefore, this fix is limited to the file mode only.


🔄 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/1954 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 5/29/2022 **Status:** ✅ Merged **Merged:** 6/12/2022 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `fix_opened_chmod` --- ### 📝 Commits (1) - [`5e0640d`](https://github.com/s3fs-fuse/s3fs-fuse/commit/5e0640dc7891b5c908519bd48be301c9630b02b2) Fixed a bug could not change the mode while the file was opened ### 📊 Changes **2 files changed** (+37 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/cache.cpp` (+6 -0) 📝 `test/integration-test-main.sh` (+31 -0) </details> ### 📄 Description ### Relevant Issue (if applicable) #1947 ### Details When using the `--in-place(-c)` option of the sed command, sed seems to behave as follows: - Create a new temporary file(create the file mode as a `0000`) - Read the original file and write the replacement result to the temporary file - Changed temporary file mode to `0644` - Close file, and replace file In s3fs, the stat information of a file is internally cached until flush is executed, during the file is opened. In sed `--in-place` mode, a `Permission denied(EACCESS)` error occurred because s3fs forgot to update the open file mode to the stat cache. So this PR fixed this bug. #### NOTE This PR added a test case. Added test case was implemented with the sed command. I made a shell script and a simple C test code and tried bug reproduction, but I couldn't reproduce the same error. So the test is implemented with the sed command. And in addition to the file mode, the file owner and group cache may also change, but I couldn't find a pattern that would cause an error while doing these things. Therefore, this fix is limited to the file mode only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:04:40 +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#2273
No description provided.