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

getDiskFormat() returns nil error if the given disk path doesn't exist. #19

Open
derekbit opened this issue Feb 13, 2025 · 1 comment
Open

Comments

@derekbit
Copy link

derekbit commented Feb 13, 2025

We found that the getDiskFormat function (code) might return a nil error if the given disk path does not exist.

If the disk path does not exist, blkid -p ... returns errno 2, indicating that the disk format was not found. Consequently, getDiskFormat() returns a nil error to its caller. However, this nil error can be misleading because it does not clearly signal that the disk is missing.

We propose that before returning ("", nil), getDiskFormat() should explicitly verify whether the disk exists. If the disk does not exist, the function should return an appropriate error instead of nil.

More context: longhorn/longhorn#10416

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

No branches or pull requests

1 participant