From 4b5496b9e074512536b1f42cb6807501693115ed Mon Sep 17 00:00:00 2001 From: lance-community Date: Mon, 23 Feb 2026 07:03:50 +0000 Subject: [PATCH] fix: resolve CI failures from run 22272601908 --- Cargo.lock | 11 +---------- Cargo.toml | 2 +- rust/lance-io/Cargo.toml | 2 +- rust/lance-io/src/object_store.rs | 25 ++++++++++++++++++++++--- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6807f608981..68c4f5d8794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5182,6 +5182,7 @@ dependencies = [ "criterion", "deepsize", "futures", + "home", "lance-arrow", "lance-core", "lance-namespace", @@ -5198,7 +5199,6 @@ dependencies = [ "rand 0.9.2", "rstest 0.23.0", "serde", - "shellexpand", "snafu", "tempfile", "test-log", @@ -8165,15 +8165,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shellexpand" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1fdf65dd6331831494dd616b30351c38e96e45921a27745cf98490458b90bb" -dependencies = [ - "dirs 6.0.0", -] - [[package]] name = "shlex" version = "1.3.0" diff --git a/Cargo.toml b/Cargo.toml index 7934b00e3cc..b1be95656d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -145,6 +145,7 @@ geo-traits = "0.3.0" geo-types = "0.7.16" http = "1.1.0" humantime = "2.2.0" +home = "0.5.12" hyperloglogplus = { version = "0.4.1", features = ["const-loop"] } itertools = "0.13" jieba-rs = { version = "0.8.1", default-features = false } @@ -177,7 +178,6 @@ rustc_version = "0.4" serde = { version = "^1" } serde_json = { version = "1" } semver = "1.0" -shellexpand = "3.0" slatedb = "0.3" snafu = "0.8" strum = "0.26" diff --git a/rust/lance-io/Cargo.toml b/rust/lance-io/Cargo.toml index 71e9dab1e9f..42b3127eb2b 100644 --- a/rust/lance-io/Cargo.toml +++ b/rust/lance-io/Cargo.toml @@ -36,11 +36,11 @@ bytes.workspace = true chrono.workspace = true deepsize.workspace = true futures.workspace = true +home.workspace = true log.workspace = true pin-project.workspace = true prost.workspace = true serde.workspace = true -shellexpand.workspace = true snafu.workspace = true tokio.workspace = true tracing.workspace = true diff --git a/rust/lance-io/src/object_store.rs b/rust/lance-io/src/object_store.rs index e908599c500..3adfdb3ebc8 100644 --- a/rust/lance-io/src/object_store.rs +++ b/rust/lance-io/src/object_store.rs @@ -16,6 +16,7 @@ use chrono::{DateTime, Utc}; use deepsize::DeepSizeOf; use futures::{future, stream::BoxStream, StreamExt, TryStreamExt}; use futures::{FutureExt, Stream}; +use home::home_dir; use lance_core::error::LanceOptionExt; use lance_core::utils::parse::str_is_truthy; use list_retry::ListRetryStream; @@ -26,7 +27,6 @@ use object_store::Error as ObjectStoreError; use object_store::{path::Path, ObjectMeta, ObjectStore as OSObjectStore}; use providers::local::FileStoreProvider; use providers::memory::MemoryStoreProvider; -use shellexpand::tilde; use snafu::location; use tokio::io::AsyncWriteExt; use url::Url; @@ -337,7 +337,7 @@ pub fn uri_to_url(uri: &str) -> Result { } fn expand_path(str_path: impl AsRef) -> Result { - let expanded = tilde(str_path.as_ref()).to_string(); + let expanded = expand_tilde(str_path.as_ref()); let mut expanded_path = path_abs::PathAbs::new(expanded) .unwrap() @@ -353,6 +353,25 @@ fn expand_path(str_path: impl AsRef) -> Result { Ok(expanded_path) } +fn expand_tilde(path: &str) -> String { + if let Some(stripped) = path.strip_prefix('~') { + if stripped.is_empty() || stripped.starts_with('/') || stripped.starts_with('\\') { + if let Some(home) = home_dir() { + let mut expanded = home; + if !stripped.is_empty() { + let suffix = stripped.trim_start_matches(&['/', '\\'][..]); + if !suffix.is_empty() { + expanded.push(suffix); + } + } + return expanded.to_string_lossy().into_owned(); + } + } + } + + path.to_string() +} + fn local_path_to_url(str_path: &str) -> Result { let expanded_path = expand_path(str_path)?; @@ -967,7 +986,7 @@ mod tests { /// Write test content to file. fn write_to_file(path_str: &str, contents: &str) -> std::io::Result<()> { - let expanded = tilde(path_str).to_string(); + let expanded = expand_tilde(path_str); let path = StdPath::new(&expanded); std::fs::create_dir_all(path.parent().unwrap())?; write(path, contents)