You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Sets all permission in a directory recursively.
@@ -74,13 +128,20 @@ impl MovementNode {
74
128
75
129
// Copy the entire .movement directory recursively
76
130
let movement_dir = dir.join(".movement");
77
-
copy_dir_recursive(&movement_dir,&debug_dir)?;
131
+
132
+
// set the permissions on the movement dir to 755
133
+
// Note: this would mess up celestia node permissions, but we don't care about that here.
134
+
// We really only care about maptos db permissions.
135
+
fs::set_permissions(&movement_dir,Permissions::from_mode(0o755)).context(format!("failed to set permissions on the movement directory {}", movement_dir.display()))?;
136
+
137
+
// don't copy anything from the celestia directory
138
+
copy_dir_recursive_with_ignore(&movement_dir,[PathBuf::from("celestia")],&debug_dir).context("failed to copy movement dir")?;
78
139
79
140
// Set all permissions in the debug directory recursively
80
141
// Note: this would mess up celestia node permissions, but we don't care about that here.
81
142
// We really only care about maptos db permissions.
set_permissions_recursive(&debug_dir,Permissions::from_mode(0o755)).context(format!("failed to set permissions on the debug directory {}", debug_dir.display()))?;
84
145
85
146
let movement_args = MovementArgs{movement_path:Some(debug_dir.display().to_string())};
86
147
@@ -415,3 +476,65 @@ impl<'a> Iterator for AccountAddressIterator<'a> {
let file_path = temp_dir.path().join("maptos").join("test_file.txt");
493
+
fs::create_dir_all(file_path.parent().context("failed to get parent directory for file that should be copied")?).context("failed to create directory")?;
494
+
fs::write(file_path,"test").context("failed to write file that should be copied")?;
495
+
496
+
// write a file that should not be copied
497
+
let file_path = temp_dir.path().join("celestia").join("test_file2.txt");
498
+
fs::create_dir_all(file_path.parent().context("failed to get parent directory for file that should not be copied")?).context("failed to create directory")?;
499
+
fs::write(file_path,"test").context("failed to write file that should not be copied")?;
500
+
501
+
// create the target temp dir
502
+
let dst = TempDir::new()?;
503
+
504
+
// copy the file to a new dir, ignoring celestia directory
505
+
copy_dir_recursive_with_ignore(&temp_dir.path(),[PathBuf::from("celestia")],&dst.path()).context("failed to copy directory")?;
let path_that_must_be_ignored = source_dir.path().join(".movement/celestia/c1860ae680eb2d91927b/.celestia-app/keyring-test");
525
+
526
+
fs::create_dir_all(path_that_must_be_ignored.parent().context("failed to get parent directory for path that must be ignored")?).context("failed to create directory")?;
527
+
// write a file that must not be ignored
528
+
fs::write(path_that_must_be_ignored.clone(),"test").context("failed to write file that must not be ignored")?;
529
+
// set permissions to 000 on the file and then on the parent directory
530
+
fs::set_permissions(path_that_must_be_ignored.clone(),Permissions::from_mode(0o000)).context("failed to set permissions on file that must not be ignored")?;
531
+
fs::set_permissions(path_that_must_be_ignored.parent().context("failed to get parent directory for path that must be ignored")?,Permissions::from_mode(0o000)).context("failed to set permissions on parent directory that must not be ignored")?;
532
+
533
+
copy_dir_recursive_with_ignore(source_dir.path(),["celestia"], target_dir.path()).context("failed to copy directory")?;
0 commit comments