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 1263351 - udev_device_new_from_subsystem_sysname unsuccessful in finding numerous devices
Summary: udev_device_new_from_subsystem_sysname unsuccessful in finding numerous devices
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: David Tardon
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-15 15:35 UTC by mulhern
Modified: 2020-04-08 13:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 12:18:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
A small c file containing a slightly better example (1.09 KB, text/plain)
2015-10-05 12:19 UTC, mulhern
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github systemd systemd pull 1466 0 None closed libsystemd: sd-device - translate / vs. ! in sysname 2020-04-08 13:11:48 UTC

Description mulhern 2015-09-15 15:35:20 UTC
Description of problem:

udev_device_new_from_subsystem_sysname does not seem to be able to find devices in unusual subsystems using the name given by udevadm. For some subsystems, it seems like no name sensibly derived from udevadm name works.

Version-Release number of selected component (if applicable):

219

How reproducible:

Consistently within a subsystem, but varies among different subsystems.

Steps to Reproduce:
1. Find a machine with devices in subsystem "iLO". Using name given by
udevadm, and also name with directory prefix truncated, method always returns NULL.
2. Find a machine with devices in subsystem input. udevadm reports name as, e.g., "input/event0", but lookup fails with this name. Need to synthesize name
by stripping "input/" prefix, at which point lookup succeeds. Seems like this
should be documented.
3. Find a machine with devices in subsystem "block" with name, e.g., "sda". Lookup works in this case.

Actual results:

Lookup doesn't work at all, or it is necessary to modify name as reported by udevadm to make it work.

Expected results:

Lookup should always work w/ unmodified name and unmodified subsystem name.

Additional info:

None.

Comment 2 mulhern 2015-09-15 15:51:26 UTC
I think that probably the reason it doesn't work at all for case (1), and kind of works for case (2), is that for case (1) the subsystem name and the directory prefix are not the same, i.e., "iLO" and "hpilo/" where as for case (2) the subsystem name, "input", and the directory prefix are the same. But that may be entirely too simplistic.

Comment 3 mulhern 2015-09-22 14:45:27 UTC
For case (1), name given by udevadm is, e.g., hpilo/d0ccb1.
For case (2), name given by udevamd is, e.g., input/event0.

For case (1), basename of DEVPATH given by udevadm is, e.g., hpilo!d0ccb1.
For case (2), basename of DEVPATH given by udevadm is, e.g,, event0.

Lookup by the basename of the DEVPATH does seem to work correctly.

But that is hardly what the documentation says.

"""
 Create new udev device, and fill in information from the sys device and the udev database entry. The device is looked up by the subsystem and name string of the device, like "mem" / "zero", or "block" / "sda".

The initial refcount is 1, and needs to be decremented to release the resources of the udev device. 
"""

Comment 4 mulhern 2015-10-05 12:19:25 UTC
Created attachment 1079920 [details]
A small c file containing a slightly better example

Shows that lookup by sysname and subsystem obtained by appropriate libudev calls fails when the sysname should include a "!".

Comment 5 mulhern 2015-10-05 12:25:11 UTC
I think that:

<dev> == udev_device_new_from_subystem_sysname(
   context,
   udev_device_get_subsystem(<dev>),
   udev_device_get_sysname(<dev>)
)

should hold true for all devices <dev>, but the attachment above illustrates that in some cases it does not.

Comment 6 Kay Sievers 2015-10-05 14:56:13 UTC
What does "using the name given by udevadm" mean?

Comment 7 mulhern 2015-10-05 15:50:58 UTC
Comments #5 and #4 give a much improved explanation of what I think is wrong.
So, udevadm could be left out of this entirely.

The output of the reproducer for the failing and for the successful runs are, respectively:

[root@megadeth reproducers]# ./a.out
hpilo/d0ccb0
iLO
[root@megadeth reproducers]# echo $?
4


and

[root@megadeth reproducers]# ./a.out
event0
input
[root@megadeth reproducers]# echo $?
0

=============================================================================

For the record, "the name given by udevadm" means the value prefixed by "N:" for a particular device in the output of "udevadm info --export-db" or similar calls.
Like this:

P: /devices/pci0000:00/0000:00:1c.2/0000:01:00.2/iLO/hpilo!d0ccb0
N: hpilo/d0ccb0
E: DEVNAME=/dev/hpilo/d0ccb0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.2/0000:01:00.2/iLO/hpilo!d0ccb0
E: MAJOR=244
E: MINOR=0
E: SUBSYSTEM=iLO

or like this:

P: /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0/event0
N: input/event0
E: DEVNAME=/dev/input/event0
E: DEVPATH=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input0/event0
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_PATH=acpi-LNXPWRBN:00
E: ID_PATH_TAG=acpi-LNXPWRBN_00
E: MAJOR=13
E: MINOR=64
E: SUBSYSTEM=input
E: TAGS=:power-switch:
E: USEC_INITIALIZED=736349

P is for path and N is for name?

Comment 8 Kay Sievers 2015-10-05 16:05:10 UTC
The kernel translates '/' in device names to '!'. libudev translates them back
to '/', but udev_device_new_from_subsystem_sysname() does not doe any
translation. We could add that, I will check.

N: is for the device in /dev, it has no direct connection to sysname in /sys,
they are different for many devices, which is fine.

Comment 11 David Tardon 2019-12-15 14:56:57 UTC
Can you test this using the rpms from http://people.redhat.com/dtardon/systemd/bz1263351-udev-lookup/ ?

Comment 12 mulhern 2019-12-16 13:52:27 UTC
I'm afraid I no longer have access to a machine w/ devices in the iLo subsystem,
or w/ any devices that would expose the code defect, AFAICT.

Comment 13 David Tardon 2020-03-31 12:18:06 UTC
Oh, well... Let's just pretend the problem doesn't exist then.

Comment 14 RHEL Program Management 2020-03-31 12:18:16 UTC
Development Management has reviewed and declined this request. You may appeal this decision by using your Red Hat support channels, who will make certain  the issue receives the proper prioritization with product and development management.

https://www.redhat.com/support/process/production/#howto

Comment 16 mulhern 2020-04-02 14:06:46 UTC
It looks like the fix was merged into the master branch in commit a9ec9f29420623133c419ddc8864921a824751fb, in Oct 2015, just a month after I reported it. I'm satisfied with it being fixed now, I don't need it fixed for RHEL 7.2.


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