rust-lang / rust-lang/rust

`std::fs::canonicalize` failed to process path mounted with cppcryptfs/dokan under windows

Open
#129,237 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-io C-bug O-windows T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

use std::fs::canonicalize;

pub fn main() {
    println!("{}", canonicalize("F:\\gofs").unwrap().display());
    // Where F:\gofs is a path mounted with cppcryptfs which use Dokan library.
}

I expected to see this happen:
print \\?\F:\gofs.

Instead, this happened:

thread 'main' panicked at src/main.rs:5:45:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "系统找不到指定的文件。" }

I have double checked that F:\gofs is exist and accessible.

Meta

rustc --version --verbose:

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: x86_64-pc-windows-msvc
release: 1.80.1
LLVM version: 18.1.7
Backtrace

stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\std\src\panicking.rs:652
   1: core::panicking::panic_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\core\src\panicking.rs:72
   2: core::result::unwrap_failed
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library\core\src\result.rs:1679
   3: enum2$<core::result::Result<std::path::PathBuf,std::io::error::Error> >::unwrap
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\core\src\result.rs:1102
   4: test_dunce::main
             at .\src\main.rs:5
   5: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\core\src\ops\function.rs:250
   6: core::hint::black_box
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23\library\core\src\hint.rs:338

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing std::fs::canonicalize on Windows with the reported F:\gofs path and compare its behavior on a cppcryptfs/Dokan mount with a normal filesystem path. Reproduce the reported NotFound error using the supplied Rust example and rustc 1.80.1; done means canonicalize handles the mounted path as expected or the limitation is documented with a confirmed explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.