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

Backport #285 display correct inotify limit error #290

Merged
merged 1 commit into from
Mar 22, 2021
Merged

Conversation

0xpr03
Copy link
Member

@0xpr03 0xpr03 commented Mar 19, 2021

Backport #285 to v4.

This approach is API breaking in one way or another. If we add another error kind (as #285 does), we break the error-API and if we use this approach by utilizing Error::Generic we make it harder to catch and also will break user code that may check for this exact error-no case to display user friendly errors. I think it'd be better to introduce a new error case, but this approach technically does not break semver.

@0xpr03 0xpr03 force-pushed the backport_285 branch 2 times, most recently from 4287a98 to 9df2018 Compare March 19, 2021 18:49
@@ -85,7 +87,7 @@
- META: Change commit message style: commits are now prefixed by a `[topic]`.
- FIX: Make sure debounced watcher terminates. [#170]
- FIX: \[Linux\] Remove thread wake-up on timeout (introduced in 4.0.5 by error). [#174]
- FIX: Restore compatibility with Rust before 1.30.0. [`eab75118`]
- FIX: Restore compatibility with Rust before 1.30.0. [`eab75118`]
Copy link
Member Author

Choose a reason for hiding this comment

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

my editor doesn't seem to like this line..

@0xpr03 0xpr03 requested a review from JohnTitor March 20, 2021 09:36
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

👍

I think it'd be better to introduce a new error case, but this approach technically does not break semver.

We're going to v5 so this is still reasonable for me as a "patch".

@0xpr03
Copy link
Member Author

0xpr03 commented Mar 20, 2021

👍

I think it'd be better to introduce a new error case, but this approach technically does not break semver.

We're going to v5 so this is still reasonable for me as a "patch".

I'm not sure I understand what you mean. That we're going towards a stable v5 ? Because this is the backport for v4.

@JohnTitor
Copy link
Member

I mean, we don't have to introduce a new error structure for v4 as it's passive-developed now (sorry if my wording is strange, I'm not a native speaker :/).

src/lib.rs Outdated
Comment on lines 524 to 529
#[cfg(target_os = "linux")]
if err.raw_os_error() == Some(28) {
return Error::Generic(String::from("Can't watch (more) files, limit on the total number of inotify watches reached"))
}
Copy link
Member

@JohnTitor JohnTitor Mar 20, 2021

Choose a reason for hiding this comment

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

Btw, I noticed this breaks our MSRV.

error: attributes are not yet allowed on `if` expressions
   --> src/lib.rs:524:9
    |
524 |         #[cfg(target_os = "linux")]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

So it should be:

Suggested change
#[cfg(target_os = "linux")]
if err.raw_os_error() == Some(28) {
return Error::Generic(String::from("Can't watch (more) files, limit on the total number of inotify watches reached"))
}
#[cfg(target_os = "linux")]
{
if err.raw_os_error() == Some(28) {
return Error::Generic(String::from("Can't watch (more) files, limit on the total number of inotify watches reached"))
}
}

@0xpr03
Copy link
Member Author

0xpr03 commented Mar 20, 2021

Ah ok makes sense, I'm not a native one either ;) I'll fix that suggestion (and CI failure) and then merge.

@JohnTitor
Copy link
Member

Ugh:
image

I forgot to backport #277 to v4, will do later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants