Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send Unix errors without wrapping them or casting them.
While trying to import MountedFast into k8s to detect mount points using openat2, several tests failed because they rely on os.IsErrNotExist / os.IsPermission which do not actually test the underlying error. For a non-existent path, if we return the bare error, this problem is solved. I tested for the following cases to ensure that backward compatibility is not broken: fmt.Println(os.IsNotExist(err)) returns false fmt.Println(os.IsNotExist(&os.PathError{ Op: "lstat", Path: "somepath", Err: err, })) returns false fmt.Println(os.IsNotExist(fmt.Errorf("unable: %w", err))) returns false fmt.Println(errors.Is(fmt.Errorf("unable: %w", err), os.ErrNotExist)) returns true. Signed-off-by: Manu Gupta <manugupt1@gmail.com>
- Loading branch information