lachlancahill opened a new issue, #715:
URL: https://github.com/apache/arrow-rs-object-store/issues/715
### **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"\\<HOST>\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\\<HOST>\\TestShare\\basic_partitioned"
url: file://<host>/TestShare/basic_partitioned/
to_file_path: "\\\\<host>\\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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]