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 fail on permissions flag #551

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

amircodota
Copy link
Contributor

I ran into a case where, specifically in inotify, if I'm watching a directory and the user does not have permissions on a subdirectory, the watch will fail.

Added a flag in the Config struct to change this behavior (still the default).

Comment on lines +7 to +8
.idea/
*.iml
Copy link
Member

Choose a reason for hiding this comment

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

Could you add them to your global gitignore instead? Accepting any IDEs makes our gitignore fat and hard to maintain.

Copy link
Member

Choose a reason for hiding this comment

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

I second this

pub fn new(
inotify: Inotify,
event_handler: Box<dyn EventHandler>,
fail_on_no_permissions: bool,
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer passing a config like this via a wrapper (a struct) instead, otherwise args could be too long and we have to expect breaking changes each time we modify.

Copy link
Member

Choose a reason for hiding this comment

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

yep, please pass the config down if possible

Copy link
Member

@0xpr03 0xpr03 left a comment

Choose a reason for hiding this comment

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

thanks for the PR - is there a reason not to fail if we're lacking permissions, making this a breaking change instead for the next major version ?


/// For the [INotifyWatcher](crate::INotifyWatcher) backend.
///
/// This flag sets whether inotify should fail when the user has no permissions on a subfolder.
Copy link
Member

Choose a reason for hiding this comment

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

I think this isn't actually true - my guess is you tested this on linux where we have to subscribe to each system ?
That's not the case on windows - not even sure if we would get any errors there. It's correct for the pollwatcher.

Comment on lines +7 to +8
.idea/
*.iml
Copy link
Member

Choose a reason for hiding this comment

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

I second this

pub fn new(
inotify: Inotify,
event_handler: Box<dyn EventHandler>,
fail_on_no_permissions: bool,
Copy link
Member

Choose a reason for hiding this comment

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

yep, please pass the config down if possible

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.

3 participants