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

Spaces before serial when using --json flag #1368

Closed
Mithrandir2k18 opened this issue Jun 29, 2021 · 1 comment
Closed

Spaces before serial when using --json flag #1368

Mithrandir2k18 opened this issue Jun 29, 2021 · 1 comment

Comments

@Mithrandir2k18
Copy link

Mithrandir2k18 commented Jun 29, 2021

When I call lsblk --json -o +serial on Ubuntu 20.04(kernel 5.4.0-71-generic ), devices that have a serial number prepend some extra spaces before the serial number inside the string.

{
   "blockdevices": [
      {"name":"nvme0n1", "maj:min":"259:0", "rm":false, "size":"477G", "ro":false, "type":"disk", "mountpoint":null,
"serial":"      SXXXXXXXXXXXX0", ...}
      ...
      
]}
@karelzak
Copy link
Collaborator

This is probably how the SERIAL is stored in udev DB. I guess we can in lsblk a little bit to clean up the string before we use it.

karelzak added a commit that referenced this issue Jul 20, 2021
These strings come from HW and udev does not modify it. It seems good
idea to clean up it before we print it.

Fixes: #1368
Signed-off-by: Karel Zak <kzak@redhat.com>
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

2 participants