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

Failure to open existing files in Open mode on windows #13861

Closed
Seldaek opened this issue Apr 30, 2014 · 1 comment · Fixed by #13865
Closed

Failure to open existing files in Open mode on windows #13861

Seldaek opened this issue Apr 30, 2014 · 1 comment · Fixed by #13865
Labels
O-windows Operating system: Windows

Comments

@Seldaek
Copy link
Contributor

Seldaek commented Apr 30, 2014

Using this code on windows the first time it works and creates the test file, the second time I run it it fails to open the file, opening with Append or Truncate mode works though.

fn main() {
    let path = Path::new("test");
    println!("{:?}", std::io::File::open_mode(&path, std::io::Open, std::io::ReadWrite));
}

Err(std::io::IoError{kind: OtherIoError, desc: "unknown error", detail: Some(~"OS Error 80: The file exists.\r\n")})

Not sure if it fails on linux, but I'll assume not since nobody reported this yet.

@alexcrichton
Copy link
Member

This succeeds on unix, and I expect windows to have the same behavior. Thanks for the report!

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 30, 2014
Previously, windows was using the CREATE_NEW flag which fails if the file
previously existed, which differed from the unix semantics. This alters the
opening to use the OPEN_ALWAYS flag to mirror the unix semantics.

Closes rust-lang#13861
bors added a commit that referenced this issue May 5, 2014
Previously, windows was using the CREATE_NEW flag which fails if the file
previously existed, which differed from the unix semantics. This alters the
opening to use the OPEN_ALWAYS flag to mirror the unix semantics.

Closes #13861
arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
derive 'Hash'

clippy doesn't like that `PartialEq` is derived, and `Hash` is manually implemented. This PR resolves that by deriving the `Hash` implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants