vermaden / lsblk

List information about block devices in the FreeBSD system.
BSD 2-Clause "Simplified" License
25 stars 2 forks source link

LABEL persists while looping past GPT disks #1

Closed RcklssNdngrmnt closed 3 years ago

RcklssNdngrmnt commented 3 years ago

When a disk is encountered which has no partition scheme, a diskid/DISK-* label is shown properly, but on the next disk with GPT partitions the raw disk shows the label from the prior disk. I have not tested with other types than GPT.

da3              0:138 373G -                  diskid/DISK-0QY4XMRA -
da4              0:201 186G GPT                diskid/DISK-0QY4XMRA -
  da4p1          0:251 512K freebsd-boot               gpt/gptboot2 -
  <FREE>         -:-   492K -                                     - -

I believe under __gpart_present() you simply need to blank the label variable as done with some other fields. After adding local LABEL="-" I see more the output I expected.

da3              0:138 373G -                  diskid/DISK-0QY4XMRA -
da4              0:201 186G GPT                                   - -
  da4p1          0:251 512K freebsd-boot               gpt/gptboot2 -
  <FREE>         -:-   492K -                                     - -

Many thanks, and best regards.

vermaden commented 3 years ago

Thank You for finding this :)

Please fetch latest lsblk to test if I put the 'local LABEL="-"' in the right place :)

I have added it here: https://github.com/vermaden/lsblk/commit/9d949239d458e4270d24e9e8d58cc48d6f41df93#diff-ade8891466c48206771f3cb0dfc42306b257e1e28b684141f4beb824832922f5

Regards.

RcklssNdngrmnt commented 3 years ago

Looks great. Thanks for building this for all of us who use multiple platforms and like to have some common tools.

vermaden commented 3 years ago

Looks great. Thanks for building this for all of us who use multiple platforms and like to have some common tools.

Thanks, I also really missed lsblk(8) on FreeBSD :)