disk management: account for leading white space in serial number

some manufacturer seem to report leading white space in the
`ID_SERIAL_SHORT` field. the regex failed here, as it just didn't
match the whitespace at all.

reported on the forum:
https://forum.proxmox.com/threads/nvme-drive-serial-unknown.163480/#post-754953

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
Link: https://lore.proxmox.com/20250312083819.15379-1-s.sterz@proxmox.com
This commit is contained in:
Shannon Sterz
2025-03-12 09:38:19 +01:00
committed by Thomas Lamprecht
parent afc58d4d95
commit 8a183b5db2

View File

@ -328,7 +328,7 @@ sub get_udev_info {
return if !defined($data->{devpath});
$data->{serial} = 'unknown';
$data->{serial} = $1 if $info =~ m/^E: ID_SERIAL_SHORT=(\S+)$/m;
$data->{serial} = $1 if $info =~ m/^E: ID_SERIAL_SHORT=\s*(\S+)$/m;
$data->{gpt} = $info =~ m/^E: ID_PART_TABLE_TYPE=gpt$/m ? 1 : 0;