From 321f87e56f776770cd4b2e0b845b60c6341aa118 Mon Sep 17 00:00:00 2001 From: Zhipeng Xie Date: Sun, 24 May 2026 17:38:45 +0800 Subject: [PATCH 1/2] fix: set st_uid/st_gid for root and Tree entries in cas_getattr Root directory and Tree (directory) entries were missing uid/gid assignment, causing mount point and all subdirectories to appear owned by root:root instead of the calling user. --- src/cas/platform/linux/fuse_adapter.cpp | 4 +++- src/cas/platform/macos/fuse_t_adapter.cpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cas/platform/linux/fuse_adapter.cpp b/src/cas/platform/linux/fuse_adapter.cpp index a6321a4..6c132a9 100644 --- a/src/cas/platform/linux/fuse_adapter.cpp +++ b/src/cas/platform/linux/fuse_adapter.cpp @@ -51,6 +51,8 @@ static int cas_getattr(const char* path, struct stat* st, struct fuse_file_info* if (std::strcmp(path, "/") == 0) { st->st_mode = S_IFDIR | 0755; st->st_nlink = 2; + st->st_uid = fuse_get_context()->uid; + st->st_gid = fuse_get_context()->gid; return 0; } @@ -60,7 +62,7 @@ static int cas_getattr(const char* path, struct stat* st, struct fuse_file_info* switch (entry->kind) { case EntryKind::Blob: st->st_mode = S_IFREG | (entry->mode & 07777); break; - case EntryKind::Tree: st->st_mode = S_IFDIR | (entry->mode & 07777); st->st_nlink = 2; return 0; + case EntryKind::Tree: st->st_mode = S_IFDIR | (entry->mode & 07777); st->st_nlink = 2; st->st_uid = fuse_get_context()->uid; st->st_gid = fuse_get_context()->gid; return 0; case EntryKind::Symlink: st->st_mode = S_IFLNK | 0777; break; default: return -ENOENT; } diff --git a/src/cas/platform/macos/fuse_t_adapter.cpp b/src/cas/platform/macos/fuse_t_adapter.cpp index 80f5389..34f96eb 100644 --- a/src/cas/platform/macos/fuse_t_adapter.cpp +++ b/src/cas/platform/macos/fuse_t_adapter.cpp @@ -64,6 +64,8 @@ static int cas_getattr(const char* path, struct stat* st) { if (std::strcmp(path, "/") == 0) { st->st_mode = S_IFDIR | 0755; st->st_nlink = 2; + st->st_uid = fuse_get_context()->uid; + st->st_gid = fuse_get_context()->gid; return 0; } @@ -77,6 +79,8 @@ static int cas_getattr(const char* path, struct stat* st) { case EntryKind::Tree: st->st_mode = S_IFDIR | (entry->mode & 07777); st->st_nlink = 2; + st->st_uid = fuse_get_context()->uid; + st->st_gid = fuse_get_context()->gid; return 0; case EntryKind::Symlink: st->st_mode = S_IFLNK | 0777; break; From 66d17a37de1aa79f005c455b4c91e4f002e9d329 Mon Sep 17 00:00:00 2001 From: Zhipeng Xie Date: Sun, 24 May 2026 18:06:18 +0800 Subject: [PATCH 2/2] fix: add sudo to dnf install command in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 215cc6e..7460bb5 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ sudo cmake --install build ```bash # Linux (openEuler) -dnf install -y cmake clang fuse3-devel bpftool libbpf-devel +sudo dnf install -y cmake clang fuse3-devel bpftool libbpf-devel cmake -B build && cmake --build build -j sudo cmake --install build ./start.sh /path/to/project