Skip to content

Conversation

@raj-prince
Copy link
Contributor

Unmount flow started returning false success during the unmount after this.

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)

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

Suggested change
return fmt.Errorf("%w: %s", ErrExternallyManagedMountPoint, err)
return fmt.Errorf("%w: %w", ErrExternallyManagedMountPoint, err)

Copy link
Contributor Author

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

Copy link

@gargnitingoogle gargnitingoogle Aug 29, 2025

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: EOF

@stapelberg stapelberg merged commit cbc61fa into jacobsa:master Aug 29, 2025
3 checks passed
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