mount-utils
mount-utils copied to clipboard
`getDiskFormat()` returns nil error if the given disk path doesn't exist.
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: https://github.com/longhorn/longhorn/issues/10416