Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 8 is returning ERROR_INVALID_HANDLE instead of NotFound when opening a missing file #95154

Closed
ehuss opened this issue Mar 20, 2022 · 9 comments
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@ehuss
Copy link
Contributor

ehuss commented Mar 20, 2022

I tried this code:

use std::fs::File;
use std::io::ErrorKind;

fn main() {
    let err = File::open("foo").unwrap_err();
    assert_eq!(err.kind(), ErrorKind::NotFound);
}

I expected to see this happen: Runs without error.

Instead, this happened: On Windows 8, it fails with error:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `Uncategorized`,
 right: `NotFound`', src\main.rs:6:5

This seems to have started with #94572, cc @sunfishcode.

This is causing cargo new to fail on Windows 8, cc rust-lang/cargo#10464

This may also be responsible for rustc's incremental support to complain, though this doesn't always happen:

warning: could not load dep-graph from `\\?\C:\Temp\empty\target\debug\incremental\empty-2s9a0rpxj1834\s-g83mc5algm-1qawwn9-working\dep-graph.bin`: The handle is invalid. (os error 6)

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (8d60bf427 2022-03-19)
binary: rustc
commit-hash: 8d60bf427a4b055f464122062e76b3ec34d4f8ba
commit-date: 2022-03-19
host: x86_64-pc-windows-msvc
release: 1.61.0-nightly
LLVM version: 14.0.0
@ehuss ehuss added O-windows Operating system: Windows regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. C-bug Category: This is a bug. labels Mar 20, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 20, 2022
@sunfishcode
Copy link
Member

I unfortunately don't have a Windows 8 box to test this on, but looking at the code, I have a theory which would explain the behavior you're seeing here, and I've now posted a fix for it here: #95158.

@AndreKR
Copy link

AndreKR commented Mar 21, 2022

This also happens on Windows 7 by the way.

@Mingun
Copy link

Mingun commented Mar 21, 2022

Confirming this on Windows 7, Windows 10 and 11 seems unaffected

@sunfishcode
Copy link
Member

@AndreKR @Mingun @ehuss #95158 has now made it to the latest nightly Rust; would you mind testing whether it fixes this issue on Windows 7 and Windows 8?

@Mingun
Copy link

Mingun commented Mar 23, 2022

Yes, after updating to rustc 1.61.0-nightly (5f37001 2022-03-22) (from rustc 1.61.0-nightly (58f1179 2022-03-17)) issue seems fixed on Windows 7!

Previously:

> cargo fmt --check
Неверный дескриптор. (os error 6)

Fixed nightly:

> cargo fmt --check
Diff in \\?\H:\Projects\quick-xml\src\de\map.rs at line 198:
...skipped...

@AndreKR
Copy link

AndreKR commented Mar 23, 2022

I can confirm that as well.

@sunfishcode
Copy link
Member

Thanks! Now we just need a confirmation for Windows 8, just to be sure :-).

@apiraino
Copy link
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 23, 2022
@ehuss
Copy link
Contributor Author

ehuss commented Mar 23, 2022

Confirmed this is resolved for Windows 8. Thanks!

@ehuss ehuss closed this as completed Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-windows Operating system: Windows P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

6 participants