Hello i'm trying to learn rust and i have a problem with a little function that i have to delete a directory and all the files recursive
fn borrar_capitulo_y_salir(capitulo_a_borrar: &Path){
println!("target: {}", capitulo_a_borrar.display());
match fs::remove_dir_all(&capitulo_a_borrar) {
Ok(_) => {println!("{}" , Green.bold().paint("Se ha borrado directorio"));
},
Err(e) => {
println!("{}, {}" , Red.bold().paint("No he podido borrar directorio") , e);
}
};
panic!();
}
When i run the program in a directory with ext4 i have not problem
Now i have changed various things:
Rust 1.9
cargo update
and the directory i have put it in a directory mounted in nfs (the server of the nfs is mounted with sync)
The problem that the rust says is:
Directory not empty (os error 39)
but after the error i look in the directory and is empty
Anybody have and idea?
pixel
June 16, 2016, 8:13pm
2
Check for hidden files, maybe there is a problem with that? Also did you try to remove the directory from a terminal? Did that work?
Just to remove variables I'd try going back to an ext4 partition just to check if that still works.
Curious but when i do it form the server that has the nfs directory, and is acceding locally to the disks (raid-5) it's okay
But when i do it in the client mounting the directory, it's deletes all the files but can't delete the directory....
pixel
June 16, 2016, 8:20pm
4
Sounds like a permission issue in the parent directory? Like your client has permission to to write to the child directory but not to the parent, so removing the child directory fails.
i don't think so because i can delete the directory (that has created my program in rust) in the client and in the server....
i think that is a problem with the "waiting" to do the next delete
Can you strace it? Might be related to slow lstat
.
I think that i have the solution the next monday i will try to
mount in the client the nfs share with the options sync,noac
Perhaps the problem is that rust is looking to the cache directory and not the real directory.... (in this way we can blame to the options of mounting the nfs, not to rust)