RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1846559 - lsscsi bug in my_strcopy() in collect_disk_wwn_nodes() results in no wwn being collected
Summary: lsscsi bug in my_strcopy() in collect_disk_wwn_nodes() results in no wwn bein...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lsscsi
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Tomáš Bžatek
QA Contact: Filip Suba
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-11 22:30 UTC by Dwight (Bud) Brown
Modified: 2024-06-13 22:42 UTC (History)
3 users (show)

Fixed In Version: lsscsi-0.32-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 14:56:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
collect_disk_wwn_nodes: Fix WWN string copy (912 bytes, patch)
2020-07-08 14:51 UTC, Tomáš Bžatek
no flags Details | Diff
one_ndev_entry: Print WWN along in combination with other print modes (1.78 KB, patch)
2020-07-08 14:51 UTC, Tomáš Bžatek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5437631 0 None None None 2020-09-28 06:39:06 UTC
Red Hat Product Errata RHBA-2021:1634 0 None None None 2021-05-18 14:57:11 UTC

Description Dwight (Bud) Brown 2020-06-11 22:30:52 UTC
Description of problem:
lsscsi --wwn does not produce output like it should, wwn field only has '0'


Version-Release number of selected component (if applicable):
0.31, bug is present in lsscsi-0.31.tgz @ http://sg.danny.cz/scsi/lsscsi.html as well.

How reproducible:
100%

Steps to Reproduce:
1. lsscsi --wwn
2.
3.

Actual results:
# lsscsi --wwn
[0:0:0:0]    storage HP       P410i            6.60                                  -        
[0:1:0:0]    disk    HP       LOGICAL VOLUME   6.60  0                                   /dev/sda 
[0:1:0:1]    disk    HP       LOGICAL VOLUME   6.60  0                                   /dev/sdb 
[1:0:0:0]    cd/dvd  hp       DVD A  DS8A8SH   KHE4                                  /dev/sr0 


Expected results:
With change from '2' to '3' length:

# ./lsscsi.dbg --wwn
[0:0:0:0]    storage HP       P410i            6.60                                  -        
[0:1:0:0]    disk    HP       LOGICAL VOLUME   6.60  0x3600508b1001cf6d83cad2f9741e23e5  /dev/sda 
[0:1:0:1]    disk    HP       LOGICAL VOLUME   6.60  0x3600508b1001c033030ea6dada3776da  /dev/sdb 
[1:0:0:0]    cd/dvd  hp       DVD A  DS8A8SH   KHE4                                  /dev/sr0 


Additional info:

Specific bug is this line:

my_strcopy(cur_ent->wwn, "0x", 2); 

should be:

my_strcopy(cur_ent->wwn, "0x", 3);

the code reserves one from max len (2) for \0, so only copies "0\0" to wwn.  Next line puts wwn starting at location 2:

                my_strcopy(cur_ent->wwn + 2, dep->d_name + 5,
                           sizeof(cur_ent->wwn) - 2);

the the \0 at indx [1] terminates the string.




A separate RFE might be to collect wwn- if scsi- for a device isn't present but not sure if that condition arises.

Also something weird with nvme and --wwn, when specified and nvme is present, the vendor name is replaced with eui. string

$ lsscsi 
[0:0:0:0]    disk    Samsung  Portable SSD T5  0     /dev/sda 
[N:0:2:1]    disk    SAMSUNG MZVKW512HMJP-000L7__1              /dev/nvme0n1

$ lsscsi --wwn
[0:0:0:0]    disk    Samsung  Portable SSD T5  0                                     /dev/sda 
[N:0:2:1]    disk    eui.002538c57100a087                       /dev/nvme0n1

Comment 1 Tomáš Bžatek 2020-07-08 14:51:06 UTC
Created attachment 1700319 [details]
collect_disk_wwn_nodes: Fix WWN string copy

(In reply to Dwight (Bud) Brown from comment #0)
> Specific bug is this line:
> 
> my_strcopy(cur_ent->wwn, "0x", 2); 
> 
> should be:
> 
> my_strcopy(cur_ent->wwn, "0x", 3);

Thanks for spotting this!

Comment 2 Tomáš Bžatek 2020-07-08 14:51:44 UTC
Created attachment 1700320 [details]
one_ndev_entry: Print WWN along in combination with other print modes

> Also something weird with nvme and --wwn, when specified and nvme is
> present, the vendor name is replaced with eui. string
> 
> $ lsscsi 
> [0:0:0:0]    disk    Samsung  Portable SSD T5  0     /dev/sda 
> [N:0:2:1]    disk    SAMSUNG MZVKW512HMJP-000L7__1              /dev/nvme0n1
> 
> $ lsscsi --wwn
> [0:0:0:0]    disk    Samsung  Portable SSD T5  0                            
> /dev/sda 
> [N:0:2:1]    disk    eui.002538c57100a087                       /dev/nvme0n1

Yeah, for some reason the WWN switch is exclusive to other print modes for NVMe devices, the attached patch tentatively decouples that, though there might be some alignment issues. 

Anyway, I've sent these patches to the lsscsi author for review.

Comment 7 Filip Suba 2020-11-26 09:39:12 UTC
Verified with lsscsi-0.32-2.el8.

# lsscsi --wwn
[2:0:1:0]    disk    LIO-ORG  test             4.0   0x3600140525c59211c1534e85aa2117f7  /dev/sda

Comment 9 errata-xmlrpc 2021-05-18 14:56:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lsscsi bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1634


Note You need to log in before you can comment on or make changes to this bug.