Skip to content

chore(io): remove shellexpand and use std::env::home_dir#5986

Closed
Xuanwo wants to merge 1 commit intolance-format:mainfrom
Xuanwo:xuanwo/remove-shellexpand-home-dir
Closed

chore(io): remove shellexpand and use std::env::home_dir#5986
Xuanwo wants to merge 1 commit intolance-format:mainfrom
Xuanwo:xuanwo/remove-shellexpand-home-dir

Conversation

@Xuanwo
Copy link
Copy Markdown
Collaborator

@Xuanwo Xuanwo commented Feb 23, 2026

Summary

  • remove shellexpand from workspace and lance-io dependencies
  • replace tilde expansion in lance-io with std::env::home_dir-based logic
  • keep support for ~ and ~/... paths (plus ~\\... on Windows)
  • update lockfile to drop shellexpand

Validation

  • cargo check -p lance-io
  • cargo test -p lance-io test_tilde_expansion -- --nocapture

@github-actions github-actions Bot added the chore label Feb 23, 2026
@Xuanwo
Copy link
Copy Markdown
Collaborator Author

Xuanwo commented Feb 23, 2026

Superseded by #5987 from origin branch.

@Xuanwo Xuanwo closed this Feb 23, 2026
@Xuanwo Xuanwo deleted the xuanwo/remove-shellexpand-home-dir branch February 23, 2026 09:19
@github-actions
Copy link
Copy Markdown
Contributor

PR Review

P0 - Use of deprecated std::env::home_dir()

The new expand_tilde_path function uses std::env::home_dir() which has been deprecated since Rust 1.29. The deprecation exists because on Windows, this function checks the HOME environment variable first (which is non-standard on Windows) before falling back to proper Windows APIs, leading to potentially incorrect results.

The workspace already has the dirs crate (v6.0.0) in Cargo.toml:

dirs = "6.0.0"

Suggested fix in rust/lance-io/src/object_store.rs:

fn expand_tilde_path(path: &str) -> Option<std::path::PathBuf> {
    let home_dir = dirs::home_dir()?;  // Use dirs crate instead of std::env::home_dir
    if path == "~" {
        return Some(home_dir);
    }
    // ... rest unchanged
}

And add to rust/lance-io/Cargo.toml:

dirs.workspace = true

This avoids the deprecation warning while using the same underlying implementation that shellexpand was using internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant