apache / apache/arrow-rs-object-store

`Path::from_absolute_path` discards UNC host on Windows, unprefixed `LocalFileSystem` cannot service UNC paths

Open
#715 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
322
Forks
212
Avg merge
5d 2h
Merged PRs (30d)
10

Description

### **Describe the bug**

On Windows, given a UNC `PathBuf` like `\\server\share\foo`, `object_store::path::Path::from_absolute_path` returns `Path("share/foo")` the host (`server`) is dropped. Combined with `LocalFileSystem` (unprefixed), this means UNC paths cannot be used end-to-end: the host is gone before `LocalFileSystem` could resolve it back to a filesystem path.

I'm filing this for visibility; whether the right fix is in `Path::from_absolute_path`, in `LocalFileSystem`, in documentation ("use `new_with_prefix` for UNC roots"), or somewhere else, I'd defer to maintainer judgement.

### **To Reproduce**

```toml
[dependencies]
url = "2.5"
object_store = "0.13"
```

```rust
fn main() {
let input = r"\\\TestShare\basic_partitioned\";
let canonical = std::fs::canonicalize(input).unwrap();
println!("canonical: {canonical:?}");
let url = url::Url::from_directory_path(&canonical).unwrap();
println!("url: {url}");
let pathbuf = url.to_file_path().unwrap();
println!("to_file_path: {pathbuf:?}");
let store_path = object_store::path::Path::from_absolute_path(&pathbuf).unwrap();
println!("object_store: {store_path}");
}
```

Output (Windows 11, `object_store 0.13.1`, `url 2.5.8`):

```
canonical: "\\\\?\\UNC\\\\TestShare\\basic_partitioned"
url: file:///TestShare/basic_partitioned/
to_file_path: "\\\\\\TestShare\\basic_partitioned\\"
object_store: TestShare/basic_partitioned <-- host dropped
```

Lines 2 and 3 confirm `url` preserves the host across the round-trip. Line 4 is where it disappears.

### **Additional context**

Surfaces as user-visible failures in:

- delta-io/delta-kernel-rs#1482
- delta-io/delta-rs#3551

A `delta-kernel-rs` patch attempting to handle this above the `object_store` boundary did not help, since the host is stripped here regardless of how the caller routes the URL conversion. Documenting this either way (whether as a bug to fix or as expected behaviour with `new_with_prefix` as the prescribed workaround) would unblock those downstream fixes.

### **Potential workaround**

`LocalFileSystem::new_with_prefix(r"\\server\share")` plus share-relative `Path`s appears to work, but requires the caller to know the UNC root in advance — which is awkward for libraries that accept user-supplied URIs.

Contributor guide

Open the contributing guide

Research direction

Start with the Windows reproduction and inspect Path::from_absolute_path, then trace how LocalFileSystem handles UNC paths and its new_with_prefix workaround. Confirm whether the host can be preserved through the existing API; done means either UNC paths work end to end or the supported workaround and its limitations are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.