From 53ec1b95d8c9b637aeb2ff05ee74abcbb18f128f Mon Sep 17 00:00:00 2001 From: houseme Date: Sun, 10 May 2026 19:52:15 +0800 Subject: [PATCH] keep sftp e2e tests buildable (#2897) --- Cargo.lock | 126 ++++-------------- Cargo.toml | 8 +- crates/audit/Cargo.toml | 1 - crates/e2e_test/Cargo.toml | 2 +- .../src/protocols/sftp_compliance_tests.rs | 18 +-- crates/notify/Cargo.toml | 1 - crates/protocols/src/sftp/errors.rs | 2 +- crates/protocols/src/sftp/mod.rs | 4 +- crates/protocols/src/sftp/paths.rs | 8 +- crates/protocols/src/sftp/write.rs | 2 +- 10 files changed, 47 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f83059541..16844be2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3610,7 +3610,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3978,7 +3978,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5028,9 +5028,9 @@ checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "hybrid-array" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d46837a0ed51fe95bd3b05de33cd64a1ee88fc797477ca48446872504507c5" +checksum = "9155a582abd142abc056962c29e3ce5ff2ad5469f4246b537ed42c5deba857da" dependencies = [ "ctutils", "subtle", @@ -5444,7 +5444,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5521,7 +5521,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6040,9 +6040,9 @@ dependencies = [ [[package]] name = "lz4_flex" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db9a0d582c2874f68138a16ce1867e0ffde6c0bb0a0df85e1f36d04146db488a" +checksum = "7ef0d4ed8669f8f8826eb00dc878084aa8f253506c4fd5e8f58f5bce72ddb97e" dependencies = [ "twox-hash", ] @@ -6665,7 +6665,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8408,7 +8408,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.60.2", + "windows-sys 0.59.0", ] [[package]] @@ -9381,7 +9381,6 @@ dependencies = [ name = "rustfs-audit" version = "1.0.0-beta.2" dependencies = [ - "async-trait", "chrono", "const-str", "futures", @@ -9484,7 +9483,7 @@ dependencies = [ name = "rustfs-ecstore" version = "1.0.0-beta.2" dependencies = [ - "aes-gcm", + "aes-gcm 0.11.0-rc.3", "async-channel", "async-recursion", "async-trait", @@ -9836,7 +9835,6 @@ dependencies = [ "axum", "chrono", "form_urlencoded", - "futures", "hashbrown 0.17.1", "quick-xml 0.39.4", "rayon", @@ -10349,7 +10347,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10432,7 +10430,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -11603,7 +11601,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -12778,7 +12776,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -12905,7 +12903,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -12914,16 +12912,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets 0.53.5", + "windows-targets", ] [[package]] @@ -12941,31 +12930,14 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm 0.53.1", - "windows_aarch64_msvc 0.53.1", - "windows_i686_gnu 0.53.1", - "windows_i686_gnullvm 0.53.1", - "windows_i686_msvc 0.53.1", - "windows_x86_64_gnu 0.53.1", - "windows_x86_64_gnullvm 0.53.1", - "windows_x86_64_msvc 0.53.1", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] @@ -12983,96 +12955,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - [[package]] name = "winnow" version = "1.0.2" diff --git a/Cargo.toml b/Cargo.toml index 6852843bb..b54369a25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -154,7 +154,7 @@ byteorder = "1.5.0" flatbuffers = "25.12.19" form_urlencoded = "1.2.2" prost = "0.14.3" -quick-xml = "0.39.3" +quick-xml = "0.39.4" rmp = { version = "0.8.15" } rmp-serde = { version = "1.3.1" } serde = { version = "1.0.228", features = ["derive"] } @@ -222,7 +222,7 @@ flate2 = "1.1.9" glob = "0.3.3" google-cloud-storage = "1.12.0" google-cloud-auth = "1.10.0" -hashbrown = { version = "0.17.0", features = ["serde", "rayon"] } +hashbrown = { version = "0.17.1", features = ["serde", "rayon"] } hex = "0.4.3" hex-simd = "0.8.0" highway = { version = "1.3.0" } @@ -307,8 +307,8 @@ libunftp = { version = "0.23.0", features = ["experimental"] } unftp-core = "0.1.0" suppaftp = { version = "8.0.3", features = ["tokio", "tokio-rustls-aws-lc-rs"] } rcgen = "0.14.7" -russh = "0.60.0" -russh-sftp = "2.1.1" +russh = "0.60.2" +russh-sftp = "2.1.2" # WebDAV dav-server = "0.11.0" diff --git a/crates/audit/Cargo.toml b/crates/audit/Cargo.toml index 0c2c4a142..77cea6b84 100644 --- a/crates/audit/Cargo.toml +++ b/crates/audit/Cargo.toml @@ -30,7 +30,6 @@ rustfs-targets = { workspace = true } rustfs-config = { workspace = true, features = ["audit", "constants"] } rustfs-ecstore = { workspace = true } rustfs-s3-common = { workspace = true } -async-trait = { workspace = true } chrono = { workspace = true } const-str = { workspace = true } futures = { workspace = true } diff --git a/crates/e2e_test/Cargo.toml b/crates/e2e_test/Cargo.toml index 5d5358802..e978e0a95 100644 --- a/crates/e2e_test/Cargo.toml +++ b/crates/e2e_test/Cargo.toml @@ -29,7 +29,7 @@ ftps = [] sftp = [] [dependencies] -rustfs-config.workspace = true +rustfs-config = { workspace = true, features = ["constants"] } rustfs-ecstore.workspace = true rustfs-common.workspace = true rustfs-rio.workspace = true diff --git a/crates/e2e_test/src/protocols/sftp_compliance_tests.rs b/crates/e2e_test/src/protocols/sftp_compliance_tests.rs index d282aa5de..8f773fdbf 100644 --- a/crates/e2e_test/src/protocols/sftp_compliance_tests.rs +++ b/crates/e2e_test/src/protocols/sftp_compliance_tests.rs @@ -300,7 +300,7 @@ async fn seed_large_via_multipart(s3: &S3Client, bucket: &str, key: &str, size_b let mut offset: u64 = 0; let mut part_number: i32 = 1; while offset < size_bytes { - let chunk = ((part_size as u64).min(size_bytes - offset)) as usize; + let chunk = (part_size as u64).min(size_bytes - offset) as usize; let mut body = vec![0u8; chunk]; for (i, b) in body.iter_mut().enumerate() { *b = ((offset + i as u64) as u8).wrapping_mul(THRASH_PATTERN_MULTIPLIER); @@ -342,7 +342,7 @@ fn calculate_pattern_sha256(size_bytes: u64, multiplier: u8) -> [u8; 32] { let mut buf = vec![0u8; chunk]; let mut written: u64 = 0; while written < size_bytes { - let n = ((chunk as u64).min(size_bytes - written)) as usize; + let n = (chunk as u64).min(size_bytes - written) as usize; for (i, b) in buf[..n].iter_mut().enumerate() { *b = ((written + i as u64) as u8).wrapping_mul(multiplier); } @@ -406,8 +406,8 @@ fn capture_server_stdout(child: &mut Child) -> Arc match join_result { Ok(Ok(p)) => p, @@ -3154,7 +3154,7 @@ pub(crate) mod cmptst_31 { eprintln!("--- end rustfs stdout dump ---"); } - let _ = tokio::time::timeout(Duration::from_secs(PAUSE31_OVERALL_DEADLINE_SECS), async { + let _ = timeout(Duration::from_secs(PAUSE31_OVERALL_DEADLINE_SECS), async { server_process.kill_and_wait().await; }) .await; @@ -3207,7 +3207,7 @@ pub(crate) mod cmptst_32 { eprintln!("--- end rustfs stdout dump ---"); } - let _ = tokio::time::timeout(Duration::from_secs(READ_CACHE_DEADLINE_SECS), async { + let _ = timeout(Duration::from_secs(READ_CACHE_DEADLINE_SECS), async { server_process.kill_and_wait().await; }) .await; @@ -3260,7 +3260,7 @@ pub(crate) mod cmptst_33 { eprintln!("--- end rustfs stdout dump ---"); } - let _ = tokio::time::timeout(Duration::from_secs(READ_CACHE_DEADLINE_SECS), async { + let _ = timeout(Duration::from_secs(READ_CACHE_DEADLINE_SECS), async { server_process.kill_and_wait().await; }) .await; diff --git a/crates/notify/Cargo.toml b/crates/notify/Cargo.toml index 33b604cd1..16d25b6d0 100644 --- a/crates/notify/Cargo.toml +++ b/crates/notify/Cargo.toml @@ -34,7 +34,6 @@ rustfs-utils = { workspace = true } arc-swap = { workspace = true } async-trait = { workspace = true } chrono = { workspace = true, features = ["serde"] } -futures = { workspace = true } form_urlencoded = { workspace = true } hashbrown = { workspace = true } rayon = { workspace = true } diff --git a/crates/protocols/src/sftp/errors.rs b/crates/protocols/src/sftp/errors.rs index 160f7f421..d53562886 100644 --- a/crates/protocols/src/sftp/errors.rs +++ b/crates/protocols/src/sftp/errors.rs @@ -13,7 +13,7 @@ // limitations under the License. //! SftpError type and the helpers that convert backend errors and -//! authorisation failures into SftpError, plus the success Status +//! authorization failures into SftpError, plus the success Status //! payload constructor. use super::constants::{http_error_codes, s3_error_codes}; diff --git a/crates/protocols/src/sftp/mod.rs b/crates/protocols/src/sftp/mod.rs index f1d486d07..ce75db1d3 100644 --- a/crates/protocols/src/sftp/mod.rs +++ b/crates/protocols/src/sftp/mod.rs @@ -51,7 +51,7 @@ //! per-session watchdog that observes the SFTP-handler activity stamp //! and the kernel TCP state for the connection. Sessions that fall //! silent at the SFTP layer while the kernel reports CLOSE_WAIT are -//! cancelled on a bounded schedule. The watchdog backstops resource +//! canceled on a bounded schedule. The watchdog backstops resource //! accumulation regardless of which layer stalled. On Linux the //! detection latency is on the order of 45 seconds; on non-Linux //! targets the watchdog falls back to an inactivity ceiling on the @@ -63,7 +63,7 @@ //! the rest. Subsequent reads inside that window are served from //! memory. Total cache memory across every live handle is bounded by //! a shared atomic accumulator enforced against the process-wide -//! ceiling. On ceiling breach the populate is skipped and the read +//! ceiling. On ceiling breach the population is skipped and the read //! serves correctly via a single backend call without storing the //! bytes for re-use. //! diff --git a/crates/protocols/src/sftp/paths.rs b/crates/protocols/src/sftp/paths.rs index a50f6527c..10906eb20 100644 --- a/crates/protocols/src/sftp/paths.rs +++ b/crates/protocols/src/sftp/paths.rs @@ -21,7 +21,7 @@ use rustfs_utils::path; /// Prefix the input with "/" if it is empty or relative. SFTP paths are /// addressed as absolute against the server root. Clients may submit a -/// relative form (e.g. "." or "foo/bar"). Both forms normalise to the +/// relative form (e.g. "." or "foo/bar"). Both forms normalize to the /// same absolute starting point before any cleaning or splitting runs. pub(super) fn ensure_absolute(path: &str) -> String { if path.is_empty() || !path.starts_with('/') { @@ -44,7 +44,7 @@ pub(super) fn last_path_component(s: &str) -> Option<&str> { /// Extract the single filename component of full_key relative to prefix. /// Returns None when full_key does not start with prefix, when the -/// residual is empty (key equalled prefix exactly), or when the residual +/// residual is empty (key equaled prefix exactly), or when the residual /// contains a slash (entry belongs under a sub-prefix and should have /// appeared via common_prefixes under delimiter="/"). pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<&'a str> { @@ -55,7 +55,7 @@ pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<& Some(residual) } -/// Canonicalise an incoming SFTP path and split it into an optional bucket +/// Canonicalize an incoming SFTP path and split it into an optional bucket /// and object key. /// /// An empty input is treated as root ("/"). An input that does not start @@ -75,7 +75,7 @@ pub(super) fn relative_filename<'a>(full_key: &'a str, prefix: &str) -> Option<& /// rejected at this boundary so a path emitted on a tracing field /// cannot inject a line into the operator log; downstream warn paths /// (skip-abort, stat fallback, REMOVE refusal) emit the bucket and key -/// without further sanitisation. +/// without further sanitization. pub(super) fn parse_s3_path(input: &str) -> Result<(String, Option), SftpError> { if input.contains(['\0', '\r', '\n']) { return Err(SftpError::code(StatusCode::BadMessage)); diff --git a/crates/protocols/src/sftp/write.rs b/crates/protocols/src/sftp/write.rs index 22e6cfd75..aaeb6e28c 100644 --- a/crates/protocols/src/sftp/write.rs +++ b/crates/protocols/src/sftp/write.rs @@ -15,7 +15,7 @@ //! Write-side state machine: open_write, commit_write, the //! write_dispatch chain that flushes a part once part_buffer reaches //! part_size, abort_upload_with_auth, close_streaming, and -//! multipart_copy. Also the cancellation-safety primitives +//! multipart_copy. Also, the cancellation-safety primitives //! (build_write_tombstone, should_abort_on_drop) that the Drop impl //! in driver.rs consumes.