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

Stabilize io_error_more #106375

Closed

Conversation

albertlarsan68
Copy link
Member

@albertlarsan68 albertlarsan68 commented Jan 2, 2023

FCP Completed in #86442 (comment)

Closes #86442

@rustbot
Copy link
Collaborator

rustbot commented Jan 2, 2023

r? @joshtriplett

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 2, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 2, 2023

The Miri subtree was changed

cc @rust-lang/miri

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

@albertlarsan68
Copy link
Member Author

@rustbot label +T-libs-api -T-libs

@rustbot rustbot 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 Jan 2, 2023
@ijackson
Copy link
Contributor

ijackson commented Jan 3, 2023

@albertlarsan68 thanks :-).

Reading #86442 (comment) there is a possibility that we want to change the categorisation of the Windows error ERROR_CANT_RESOLVE_FILENAME from Uncategorized to FilesystemLoop.

I don't think that needs to be done in this MR, and I don't think it needs to block the stabilisation. I think it is probably best to leave this to Windows experts.

(FTAOD I don't agree with the suggestion there to rename the error to LoopError, for both substantive and procedural reasons.)

@kalcutter
Copy link

I think FilesystemQuotaExceeded should be renamed QuotaExceeded (see #86442 (comment)).

Would you also consider NotSameDevice instead of CrossesDevices?

@albertlarsan68
Copy link
Member Author

I would leave this decision to a T-libs-api member, there did not seem to be a consensus.

@joshtriplett
Copy link
Member

With my libs-api hat on: 👍 for renaming FilesystemQuotaExceeded to QuotaExceeded, as OSes may use it for other kinds of quotas.

I have a mild preference for renaming FilesystemLoop to something that doesn't include Filesystem, for the same reason: OSes do use it for other errors. For instance, Linux also uses it for keyrings, BPF, network routing/filtering, vhost, and network bridges.

I personally don't think we should rename CrossesDevices.

@albertlarsan68
Copy link
Member Author

Is LoopDetected good enough for FilesystemLoop?

@ijackson
Copy link
Contributor

ijackson commented Jan 5, 2023

Process

This seems highly irregular from a governance perspective.

We have completed the FCP on the names as they have been in unstable for a year and a half now. Proposals to rename them were made in the FCP but not accepted and instead the FCP was approved with a disposition to "merge".

Changing the names and therefore implied semantics after 18 months in unstable, and after the FCP, seems quite wrong to me.

If there is an open question about some of these, we could stabilise a subset. Any proposal to change the names and meanings ought then to be dealt with in a separate MR.

Given the amount of extensive discussion and consideration these received in the tracking issue thread, any such change ought to be made with deliberation.

Substance

I disagree with renaming FilesystemLoop.

It is true that Unix has a tendency to reuse errno values, so that any particular errno value can often mean a variety of things. Particularly, less-common (even, obscure) APIs and facilities (ab)use errno values. Attempting to represent all these obscure possibilities leads to descriptions and categorisations that are vague and overlapping. We generally haven't done that and I don't think we should start now. (All of this was discussed at length in the earlier conversations in the tracking issue.)

The APIs available in std will produce this error for filesystem operations, not obscure other purposes. I think calling oit FilesystemLoop is sensible.

I am not quite so sure about FilesystemQuotaExceeded but again I think APIs in std won't produce this error other than for filesystem operations.

@albertlarsan68
Copy link
Member Author

albertlarsan68 commented Jan 5, 2023

I am thus dropping the rename of FilesystemLoop, but since the change of FilesystemQuotaExceeded was approved by a T-libs-api member, I propose to keep it, unless I should stabilize only a subset, which would be quite sad.

PS: the commit that does the loop rename is 913ac3ef23d8e704ffb02c0c68bb31909cf1968f

@kalcutter
Copy link

kalcutter commented Jan 5, 2023

There is also the winsock error WSAEDQUOT. Shouldn't that be mapped here https://github.com/rust-lang/rust/blob/master/library/std/src/sys/windows/mod.rs#L112 to QuotaExceeded?

@ijackson
Copy link
Contributor

ijackson commented Jan 5, 2023

There is also the winsock error WSAEDQUOT. Shouldn't that be mapped here https://github.com/rust-lang/rust/blob/master/library/std/src/sys/windows/mod.rs#L112 to QuotaExceeded?

Yes, I think so. I'm not sure why we overlooked that. Generally I would expect that a WSAE error should be mapped the same way as the correspondingly named E error on Unix. I think I tired to do that. Are there other omissions?

@albertlarsan68
Copy link
Member Author

I think moving errors from Uncategorized to a specific category is outside the scope for this PR and FCP, but feel free to do so in another PR. This will not be a breaking change, since the current Uncategorized errors are not matchable on stable.

@albertlarsan68 albertlarsan68 deleted the stabilize-io_err_more branch January 11, 2023 07:14
@albertlarsan68 albertlarsan68 restored the stabilize-io_err_more branch January 15, 2023 11:18
@albertlarsan68
Copy link
Member Author

Ping to @joshtriplett, what is the state ?

@vi
Copy link
Contributor

vi commented Feb 18, 2023

Maybe uncontroversial variants can be stabilised first and other variants (such as QuotaExceeded or FilesystemLoop) later?

@ChrisDenton
Copy link
Member

There have been questions raised about InvalidFilename too.. See the tracking issue.

@Dylan-DPC Dylan-DPC added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2023
@jdahlstrom
Copy link

jdahlstrom commented Sep 3, 2023

Seeing that this doesn't seem to be moving and there are other unresolved questions despite the FCP, I'll mention kornel's comment from Dec 30, 2023 that doesn't seem to have been acknowledged:

std uses file_name in functions, rather than filename. It'd be odd to break correspondence between snake_case and CamelCase, so I think this should be FileNameTooLong to match. Same goes for InvalidFileName.

@tertsdiepraam
Copy link

I would like to voice support stabilization of the uncontroversial variants. This would get those variants to stable and focus the discussion around the more controversial ones. I don't see any particular reason that all of these must be stabilized at the same time. Is there prior art to stabilizing a part of a feature?

In particular, in uutils, we would like to use IsADirectory, NotADirectory & DirectoryNotEmpty, which come up often with file system operations.

@joshtriplett
Copy link
Member

Please do not consider me a blocker for anything here.

@bors
Copy link
Contributor

bors commented Jan 13, 2024

☔ The latest upstream changes (presumably #117285) made this pull request unmergeable. Please resolve the merge conflicts.

@joshtriplett
Copy link
Member

r? libs-api

@ARitz-Cracker
Copy link

ARitz-Cracker commented Feb 22, 2024

Are there any remaining blockers on this? Because some of these ErrorKind extensions, including the network and directory related ones, are long overdue.

If this is being held up due to a single comment suggesting splitting some kind of "File name too long" variant of ErrorKind from InvalidFilename, then I'd like to voice a disagreement with that.

In the vast majority of cases, any reason why InvalidFilename would be returned in its current state is entirely system specific, and I'd argue that if your archive or bulk-downloading program encounters that error, it should examine the entire path and correct whatever's necessary. For example, blindly truncating won't help you in a situation where you're dealing with Window's 260 max path char length when you're not using full canonical paths. (iirc it was the cause of some source engine RCE vulnerability) This illustrates there are even system specific quirks as to how long a file name and path can be depending on how you format the path.

Since Rust has no builtin mechanism to answer the question "What are the limitations of the filesystem and OS I'm currently dealing with?" in a cross platform manner, then I don't think it's productive to have error codes which can encourage naive and potentially harmful error handling.

The introduction of InvalidFilename already tells us there's something wrong with our path, and that already gives us enough information for what corrective action we should take. We're already on the cold path anyway, so is it really that hard to check whether or not our path is canonical and all the segments are less than 255 chars long while also checking whether or not the path contains characters or reserved keywords that the OS doesn't like?

Edit: Apologies for writing 2 variants, I had multiple tabs open and I thought I lost the previous message instead of posting it.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 10, 2024
…r=dtolnay

Stabilize most of `io_error_more`

Sadly, venting my frustration with t-libs-api is not a constructive way to solve problems and get things done, so I will try to stick to stuff that actually matters here.

- Tracking issue for this feature was opened 3 years ago: rust-lang#86442
- FCP to stabilize it was completed 19(!!) months ago: rust-lang#86442 (comment)
- A PR with stabilization was similarly open for 19 months: rust-lang#106375, but nothing ever came out of it. Presumably (it is hard to judge given the lack of communication) because a few of the variants still had some concerns voiced about them, even after the FCP.

So, to highlight a common sentiment:

> Maybe uncontroversial variants can be stabilised first and other variants (such as `QuotaExceeded` or `FilesystemLoop`) later? [^1]

[^1]: rust-lang#106375 (comment)

> I would like to voice support stabilization of the uncontroversial variants. This would get those variants to stable and focus the discussion around the more controversial ones. I don't see any particular reason that all of these must be stabilized at the same time. [...] [^2]

[^2]: rust-lang#106375 (comment)

> Maybe some less-controversial subset could be stabilized sooner? What’s blocking this issue from making progress? [^3]

[^3]: rust-lang#86442 (comment) (got 30 upvotes btw) (and no response)

So this is exactly what this PR does. It stabilizes the non-controversial variants now, leaving just a few of them behind.

Namely, this PR stabilizes:

- `HostUnreachable`
- `NetworkUnreachable`
- `NetworkDown`
- `NotADirectory`
- `IsADirectory`
- `DirectoryNotEmpty`
- `ReadOnlyFilesystem`
- `StaleNetworkFileHandle`
- `StorageFull`
- `NotSeekable`
- `FileTooLarge`
- `ResourceBusy`
- `ExecutableFileBusy`
- `Deadlock`
- `TooManyLinks`
- `ArgumentListTooLong`
- `Unsupported`

This PR does not stabilize:
- `FilesystemLoop`
- `FilesystemQuotaExceeded`
- `CrossesDevices`
- `InvalidFilename`

Hopefully, this will allow us to move forward with this highly and long awaited addition to std, both allowing to still polish the less clear parts of it and not leading to stagnation.

r? joshtriplett
because they seem to be listed as a part of t-libs-api and were one of the most responsive persons previously
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Sep 10, 2024
…r=dtolnay

Stabilize most of `io_error_more`

Sadly, venting my frustration with t-libs-api is not a constructive way to solve problems and get things done, so I will try to stick to stuff that actually matters here.

- Tracking issue for this feature was opened 3 years ago: rust-lang#86442
- FCP to stabilize it was completed 19(!!) months ago: rust-lang#86442 (comment)
- A PR with stabilization was similarly open for 19 months: rust-lang#106375, but nothing ever came out of it. Presumably (it is hard to judge given the lack of communication) because a few of the variants still had some concerns voiced about them, even after the FCP.

So, to highlight a common sentiment:

> Maybe uncontroversial variants can be stabilised first and other variants (such as `QuotaExceeded` or `FilesystemLoop`) later? [^1]

[^1]: rust-lang#106375 (comment)

> I would like to voice support stabilization of the uncontroversial variants. This would get those variants to stable and focus the discussion around the more controversial ones. I don't see any particular reason that all of these must be stabilized at the same time. [...] [^2]

[^2]: rust-lang#106375 (comment)

> Maybe some less-controversial subset could be stabilized sooner? What’s blocking this issue from making progress? [^3]

[^3]: rust-lang#86442 (comment) (got 30 upvotes btw) (and no response)

So this is exactly what this PR does. It stabilizes the non-controversial variants now, leaving just a few of them behind.

Namely, this PR stabilizes:

- `HostUnreachable`
- `NetworkUnreachable`
- `NetworkDown`
- `NotADirectory`
- `IsADirectory`
- `DirectoryNotEmpty`
- `ReadOnlyFilesystem`
- `StaleNetworkFileHandle`
- `StorageFull`
- `NotSeekable`
- `FileTooLarge`
- `ResourceBusy`
- `ExecutableFileBusy`
- `Deadlock`
- `TooManyLinks`
- `ArgumentListTooLong`
- `Unsupported`

This PR does not stabilize:
- `FilesystemLoop`
- `FilesystemQuotaExceeded`
- `CrossesDevices`
- `InvalidFilename`

Hopefully, this will allow us to move forward with this highly and long awaited addition to std, both allowing to still polish the less clear parts of it and not leading to stagnation.

r? joshtriplett
because they seem to be listed as a part of t-libs-api and were one of the most responsive persons previously
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2024
Rollup merge of rust-lang#128316 - GrigorenkoPV:io_error_a_bit_more, r=dtolnay

Stabilize most of `io_error_more`

Sadly, venting my frustration with t-libs-api is not a constructive way to solve problems and get things done, so I will try to stick to stuff that actually matters here.

- Tracking issue for this feature was opened 3 years ago: rust-lang#86442
- FCP to stabilize it was completed 19(!!) months ago: rust-lang#86442 (comment)
- A PR with stabilization was similarly open for 19 months: rust-lang#106375, but nothing ever came out of it. Presumably (it is hard to judge given the lack of communication) because a few of the variants still had some concerns voiced about them, even after the FCP.

So, to highlight a common sentiment:

> Maybe uncontroversial variants can be stabilised first and other variants (such as `QuotaExceeded` or `FilesystemLoop`) later? [^1]

[^1]: rust-lang#106375 (comment)

> I would like to voice support stabilization of the uncontroversial variants. This would get those variants to stable and focus the discussion around the more controversial ones. I don't see any particular reason that all of these must be stabilized at the same time. [...] [^2]

[^2]: rust-lang#106375 (comment)

> Maybe some less-controversial subset could be stabilized sooner? What’s blocking this issue from making progress? [^3]

[^3]: rust-lang#86442 (comment) (got 30 upvotes btw) (and no response)

So this is exactly what this PR does. It stabilizes the non-controversial variants now, leaving just a few of them behind.

Namely, this PR stabilizes:

- `HostUnreachable`
- `NetworkUnreachable`
- `NetworkDown`
- `NotADirectory`
- `IsADirectory`
- `DirectoryNotEmpty`
- `ReadOnlyFilesystem`
- `StaleNetworkFileHandle`
- `StorageFull`
- `NotSeekable`
- `FileTooLarge`
- `ResourceBusy`
- `ExecutableFileBusy`
- `Deadlock`
- `TooManyLinks`
- `ArgumentListTooLong`
- `Unsupported`

This PR does not stabilize:
- `FilesystemLoop`
- `FilesystemQuotaExceeded`
- `CrossesDevices`
- `InvalidFilename`

Hopefully, this will allow us to move forward with this highly and long awaited addition to std, both allowing to still polish the less clear parts of it and not leading to stagnation.

r? joshtriplett
because they seem to be listed as a part of t-libs-api and were one of the most responsive persons previously
@GrigorenkoPV
Copy link
Contributor

Now that #128316 is merged, I guess this PR can be closed. Not to mention it has had merge conflicts for nearly 8 months.

The 4 variants that remain unstable first need some discussion, and when (and if ever) we get to stabilizing them, a new PR can be opened.

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 11, 2024
Stabilize most of `io_error_more`

Sadly, venting my frustration with t-libs-api is not a constructive way to solve problems and get things done, so I will try to stick to stuff that actually matters here.

- Tracking issue for this feature was opened 3 years ago: #86442
- FCP to stabilize it was completed 19(!!) months ago: rust-lang/rust#86442 (comment)
- A PR with stabilization was similarly open for 19 months: #106375, but nothing ever came out of it. Presumably (it is hard to judge given the lack of communication) because a few of the variants still had some concerns voiced about them, even after the FCP.

So, to highlight a common sentiment:

> Maybe uncontroversial variants can be stabilised first and other variants (such as `QuotaExceeded` or `FilesystemLoop`) later? [^1]

[^1]: rust-lang/rust#106375 (comment)

> I would like to voice support stabilization of the uncontroversial variants. This would get those variants to stable and focus the discussion around the more controversial ones. I don't see any particular reason that all of these must be stabilized at the same time. [...] [^2]

[^2]: rust-lang/rust#106375 (comment)

> Maybe some less-controversial subset could be stabilized sooner? What’s blocking this issue from making progress? [^3]

[^3]: rust-lang/rust#86442 (comment) (got 30 upvotes btw) (and no response)

So this is exactly what this PR does. It stabilizes the non-controversial variants now, leaving just a few of them behind.

Namely, this PR stabilizes:

- `HostUnreachable`
- `NetworkUnreachable`
- `NetworkDown`
- `NotADirectory`
- `IsADirectory`
- `DirectoryNotEmpty`
- `ReadOnlyFilesystem`
- `StaleNetworkFileHandle`
- `StorageFull`
- `NotSeekable`
- `FileTooLarge`
- `ResourceBusy`
- `ExecutableFileBusy`
- `Deadlock`
- `TooManyLinks`
- `ArgumentListTooLong`
- `Unsupported`

This PR does not stabilize:
- `FilesystemLoop`
- `FilesystemQuotaExceeded`
- `CrossesDevices`
- `InvalidFilename`

Hopefully, this will allow us to move forward with this highly and long awaited addition to std, both allowing to still polish the less clear parts of it and not leading to stagnation.

r? joshtriplett
because they seem to be listed as a part of t-libs-api and were one of the most responsive persons previously
@RalfJung RalfJung closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-blocked Status: Blocked on something else such as an RFC or other implementation work. 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.

Tracking Issue for io_error_more