This is an automated email from the ASF dual-hosted git repository.
fanng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 3dd35ad838 [#6464] fix (gvfs-fuse): Fix the bug of using a relative
path to configure gvfs-fuse. (#6465)
3dd35ad838 is described below
commit 3dd35ad8380bbf7df20b28ab611f8f13e6439677
Author: Yuhui <[email protected]>
AuthorDate: Tue Feb 18 08:19:44 2025 +0800
[#6464] fix (gvfs-fuse): Fix the bug of using a relative path to configure
gvfs-fuse. (#6465)
### What changes were proposed in this pull request?
Fix the bug of using a relative path to configure gvfs-fuse.
### Why are the changes needed?
Fix: #6464
### Does this PR introduce _any_ user-facing change?
NO
### How was this patch tested?
Manually test
---
clients/filesystem-fuse/conf/gvfs_fuse.toml | 2 +-
clients/filesystem-fuse/src/main.rs | 15 +++++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/clients/filesystem-fuse/conf/gvfs_fuse.toml
b/clients/filesystem-fuse/conf/gvfs_fuse.toml
index 27e52fc7d5..455222ce33 100644
--- a/clients/filesystem-fuse/conf/gvfs_fuse.toml
+++ b/clients/filesystem-fuse/conf/gvfs_fuse.toml
@@ -20,7 +20,7 @@
file_mask = 0o600
dir_mask = 0o700
fs_type = "memory"
-data_path = "target/gvfs-fuse"
+data_dir = "target/gvfs-fuse"
[fuse.properties]
diff --git a/clients/filesystem-fuse/src/main.rs
b/clients/filesystem-fuse/src/main.rs
index 6c8c0f4e0e..45fa26a827 100644
--- a/clients/filesystem-fuse/src/main.rs
+++ b/clients/filesystem-fuse/src/main.rs
@@ -32,15 +32,13 @@ use tokio::runtime::Runtime;
use tokio::signal;
use tokio::signal::unix::{signal, SignalKind};
-fn init_work_dirs(config: &AppConfig, mount_point: &str) -> io::Result<()> {
+fn init_dirs(config: &mut AppConfig, mount_point: &str) -> io::Result<()> {
let data_dir_name = Path::new(&config.fuse.data_dir).to_path_buf();
- let data_dir_name = data_dir_name.canonicalize()?;
if !data_dir_name.exists() {
- Err(io::Error::new(
- io::ErrorKind::NotFound,
- format!("Data directory {} not found", &config.fuse.data_dir),
- ))?
+ create_dir(&data_dir_name)?
};
+ let data_dir_name = data_dir_name.canonicalize()?;
+ config.fuse.data_dir = data_dir_name.to_string_lossy().to_string();
let mount_point_name = data_dir_name.join(mount_point);
if !mount_point_name.exists() {
@@ -48,6 +46,7 @@ fn init_work_dirs(config: &AppConfig, mount_point: &str) ->
io::Result<()> {
};
let log_dir_name = data_dir_name.join(&config.fuse.log_dir);
+ config.fuse.log_dir = log_dir_name.to_string_lossy().to_string();
if !log_dir_name.exists() {
create_dir(&log_dir_name)?
};
@@ -182,7 +181,7 @@ fn main() -> Result<(), i32> {
error!("Failed to load config: {:?}", e);
return Err(-1);
};
- let app_config = app_config.unwrap();
+ let mut app_config = app_config.unwrap();
let mount_point = {
let path = Path::new(&mount_point).canonicalize();
@@ -194,7 +193,7 @@ fn main() -> Result<(), i32> {
path.to_string_lossy().to_string()
};
- let result = init_work_dirs(&app_config, &mount_point);
+ let result = init_dirs(&mut app_config, &mount_point);
if let Err(e) = result {
error!("Failed to initialize working directories: {:?}", e);
return Err(-1);