-
Notifications
You must be signed in to change notification settings - Fork 115
fix: false success in unmount flow #182
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
Conversation
a946004 to
891da64
Compare
| if err := fuserunmount(dir); err != nil { | ||
| // Return custom error for fusermount unmount error for /dev/fd/N mountpoints | ||
| if strings.HasPrefix(dir, "/dev/fd/") { | ||
| return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not possible or not desirable to wrap both errors here ? e.g. something like
| return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err) | |
| return fmt.Errorf("%w: %w", ErrExternallyManagedMountPoint, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, not desirable. Also, Unwrap doesn't work in multi %w scenario - https://go.dev/play/p/3aixFmasPAK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the sample you attached (thanks for it BTW), I see that the errors.Is returns true for both errors on the combined error, but errors.Wrap return nil on it, which is surprizing a bit.
Error: externally managed mount point: EOF
errors.Is(errWW, ErrExternallyManagedMountPoint): true
errors.Is(errWW, ErrUnderlying): true
errors.Unwrap(errWW): <nil>I am just worried that not wrapping the returned error on the original error would just lose information. There is a way to wrap multiple errors, that can be also be returned using UnWrap e.g. in this sample https://go.dev/play/p/VarDGW6zVe6 , but it's definitely not very easy to use. It returns this:
errors.Is(errWW, ErrExternallyManagedMountPoint): true
errors.Is(errWW, ErrUnderlying): true
Unwrapped error 1: externally managed mount point
Unwrapped error 2: EOF752342c to
e6bd908
Compare
e6bd908 to
365a485
Compare
Unmount flow started returning false success during the unmount after this.