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

Add a File::create_new constructor #98801

Merged
merged 1 commit into from
Aug 29, 2022
Merged

Conversation

joshtriplett
Copy link
Member

We have File::create for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via OpenOptions.

Add File::create_new to handle this case, to make it easier for people
to do secure file creation.

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jul 2, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2022

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive
Copy link
Collaborator

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 2, 2022
@joshtriplett joshtriplett added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 2, 2022
@joshtriplett
Copy link
Member Author

r? rust-lang/libs-api

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
@joshtriplett
Copy link
Member Author

Updated to incorporate feedback.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 13, 2022
Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me on the impl. Not sure if anything is needed for API review, feel free to land if not.

@joshtriplett
Copy link
Member Author

@bors r=thomcc

@bors
Copy link
Contributor

bors commented Aug 26, 2022

📌 Commit e540425 has been approved by thomcc

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 26, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 26, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 26, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 26, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 26, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Aug 27, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 27, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 28, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Aug 29, 2022
Add a `File::create_new` constructor

We have `File::create` for creating a file or opening an existing file,
but the secure way to guarantee creating a new file requires a longhand
invocation via `OpenOptions`.

Add `File::create_new` to handle this case, to make it easier for people
to do secure file creation.
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 29, 2022
Rollup of 8 pull requests

Successful merges:

 - rust-lang#98304 (Add MaybeUninit memset test)
 - rust-lang#98801 (Add a `File::create_new` constructor)
 - rust-lang#99821 (Remove separate indexing of early-bound regions)
 - rust-lang#100239 (remove an ineffective check in const_prop)
 - rust-lang#100337 (Stabilize `std::io::read_to_string`)
 - rust-lang#100819 (Make use of `[wrapping_]byte_{add,sub}`)
 - rust-lang#100934 (Remove a panicking branch from `fmt::builders::PadAdapter`)
 - rust-lang#101000 (Separate CountIsStar from CountIsParam in rustc_parse_format.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1999ed7 into rust-lang:master Aug 29, 2022
@rustbot rustbot added this to the 1.65.0 milestone Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants