xfs support in test_rename_directory_to_non_empty_directory
Seemingly on XFS only, the `AlreadyExists` variant is returned.
Reproducible on Linux hosts:
```rust
use clap::Parser;
struct Args {
/// Destination to try
#[arg()]
path: std::path::PathBuf,
}
fn main() {
let args = Args::parse();
// Renaming a directory over a non-empty existing directory should fail.
let tmpdir = std::path::Path::new(&args.path);
std::fs::create_dir_all(tmpdir).unwrap();
let source_path = tmpdir.join("source_directory");
let target_path = tmpdir.join("target_directory");
std::fs::create_dir(&source_path).unwrap();
std::fs::create_dir(&target_path).unwrap();
let target_path_file = target_path.join("target_file.txt");
std::fs::write(target_path.join("target_file.txt"), b"target hello world").unwrap();
println!("wrote {target_path_file:?}");
println!("{source_path:?} -> {target_path:?}");
let err = std::fs::rename(source_path, target_path).unwrap_err();
assert_eq!(err.kind(), std::io::ErrorKind::DirectoryNotEmpty);
}
```
```bash
XFS_BLOCK=image-xfs
truncate -s 512M image-xfs
mkfs.xfs -q image-xfs
mkdir mnt-xfs
sudo mount -o loop image-xfs mnt-xfs
sudo chmod 777 mnt-xfs
cargo run -- mnt-xfs/
```
Output:
```
wrote "mnt-xfs/target_directory/target_file.txt"
"mnt-xfs/source_directory" -> "mnt-xfs/target_directory"
thread 'main' (267220) panicked at src/main.rs:30:5:
assertion `left == right` failed
left: AlreadyExists
right: DirectoryNotEmpty
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
Website | Getting started | Learn | Documentation | Contributing
This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.
Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.
Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).
Read “Installation” from The Book.
If you really want to install from source (though this is not recommended), see INSTALL.md.
See https://www.rust-lang.org/community for a list of chat platforms and forums.
See CONTRIBUTING.md.
For a detailed explanation of the compiler's architecture and how to begin contributing, see the rustc-dev-guide.
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”).
If you want to use these names or brands, please read the Rust language trademark policy.
Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.