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 'ensure_last_os_error()', fixes #176 #178

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

cehteh
Copy link
Contributor

@cehteh cehteh commented Sep 20, 2021

Under some conditions 'fuse_session_mount()' may return -1 to indicate an error but does not
set errno. 'io::Error::last_os_error()' will then be equivalent to 'Err(Success)' which is
somewhat surprising.

'ensure_last_os_error()' translates (only) these into an 'Error(Other, "Unspecified
Error")'. Programs can thus rely to get an at least descriptive error.

Under some conditions 'fuse_session_mount()' may return -1 to indicate an error but does not
set errno. 'io::Error::last_os_error()' will then be equivalent to 'Err(Success)' which is
somewhat surprising.

'ensure_last_os_error()' translates (only) these into an 'Error(Other, "Unspecified
Error")'. Programs can thus rely to get an at least descriptive error.
@cberner cberner merged commit 18fe7be into cberner:master Sep 22, 2021
@cberner
Copy link
Owner

cberner commented Sep 22, 2021

Merged. Thanks!

str4d added a commit to str4d/fuser that referenced this pull request Aug 21, 2022
Under some conditions, `fuse_mount_compat25` may return -1 to indicate
an error but does not set errno. `io::Error::last_os_error()` will then
be equivalent to `Err(Success)` which is somewhat surprising.

In particular, if the mount options `auto_unmount,allow_{root,other}`
are set but the user does not have `user_allow_other` set in their
`fuse.conf`, the `fusermount` binary will print an error message to
stderr but not set errno.

`fusermount3` has the same behaviour, but this issue was mitigated for
the libfuse3 binding in cberner#178 by mapping `Err(Success)` to
the slightly more useful `Error(Other, "Unspecified Error")`. This
commit applies the same fix to the libfuse2 binding.
str4d added a commit to str4d/fuser that referenced this pull request Aug 24, 2022
Under some conditions, `fuse_mount_compat25` may return -1 to indicate
an error but does not set errno. `io::Error::last_os_error()` will then
be equivalent to `Err(Success)` which is somewhat surprising.

In particular, if the mount options `auto_unmount,allow_{root,other}`
are set but the user does not have `user_allow_other` set in their
`fuse.conf`, the `fusermount` binary will print an error message to
stderr but not set errno.

`fusermount3` has the same behaviour, but this issue was mitigated for
the libfuse3 binding in cberner#178 by mapping `Err(Success)` to
the slightly more useful `Error(Other, "Unspecified Error")`. This
commit applies the same fix to the libfuse2 binding.
cberner pushed a commit that referenced this pull request Aug 24, 2022
Under some conditions, `fuse_mount_compat25` may return -1 to indicate
an error but does not set errno. `io::Error::last_os_error()` will then
be equivalent to `Err(Success)` which is somewhat surprising.

In particular, if the mount options `auto_unmount,allow_{root,other}`
are set but the user does not have `user_allow_other` set in their
`fuse.conf`, the `fusermount` binary will print an error message to
stderr but not set errno.

`fusermount3` has the same behaviour, but this issue was mitigated for
the libfuse3 binding in #178 by mapping `Err(Success)` to
the slightly more useful `Error(Other, "Unspecified Error")`. This
commit applies the same fix to the libfuse2 binding.
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