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 1283386 - udev_device_get_sysattr_list entry and udev_device_get_sysattr_value do not agree
Summary: udev_device_get_sysattr_list entry and udev_device_get_sysattr_value do not a...
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: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-18 20:48 UTC by mulhern
Modified: 2015-11-25 18:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-25 18:15:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1267584 0 unspecified CLOSED device.attributes.values likely to raise a KeyError 2021-02-22 00:41:40 UTC

Internal Links: 1267584

Description mulhern 2015-11-18 20:48:22 UTC
Description of problem:

At first I thought that udev_device_get_sysattr_list_entry returned a superset of the keys that udev_device_get_sysattr_value can find values for. That made some kind of sense, because udev_device_get_sysattr_list_entry finds file names and does not try to read there contents, that's udev_device_get_sysattr_value's job. But now, I find that udev_device_get_sysattr_value can often look up values that have no corresponding keys in the list returned by udev_device_get_sysattr_list_entry.

So the best that one can say is that the intersection of the strings returned by udev_device_get_sysattr_list_entry and of the strings for which udev_device_get_sysattr_value returns a non-NULL value is very likely to be non-empty.

It seems like having the keys returned by udev_device_get_sysattr_list_entry be a superset of the keys that can be evaluated by udev_device_get_sysattr_value would be the only sensible way to go to get a useful relationship going between these two related methods.

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

Installed Packages
Name        : systemd
Arch        : x86_64
Version     : 219
Release     : 19.el7
Size        : 21 M
Repo        : installed
From repo   : RHEL-7-RTT


How reproducible:

Always.

Steps to Reproduce:
1. Get the list of keys using udev_device_get_sysattr_list_entry.
2. Notice that bdi is a key with no corresponding value (it's a directory)
3. Notice that bdi/max_ratio is looked up fine by udev_device_get_sysattr_value but is not in the list of keys.
4. Notice that 'dm/name' is is looked up fine but is not in the list of keys and nor is 'dm' either.

Actual results:

A very unclear relationship between result of udev_device_get_sysattr_list_entry and udev_device_get_sysattr_value.

Expected results:

I was lead to believe originally that there was a superset relationship between the keys returned by udev_device_get_sysattr_list_entry and those that
udev_device_get_sysattr_value could get a value for.

Additional info:

Comment 2 mulhern 2015-11-25 18:10:51 UTC
And the answer to what is actually going on:

libudev just reads the contents of the directory corresponding to the device.
The keys are the names of all files in the directory that are plain files or links.

When libudev looks up values it interprets the "key" as a path relative to the sysfs
directory. If that path is a link, then for the special names in
{'driver', 'subsystem', 'module'} it returns the value of the basename of the path
that is the target of the link. For all other links it returns NULL. For directories
it returns NULL. For regular files, it reads the contents of the file.

This explains why 'dm' is not an 'available' attribute, why 'bdi' is, why the value of
'bdi' is always NULL, and why subsystem is an "available" attribute, with, generally,
a non-NULL value.

There is probably nothing to be done about this. Perhaps a comment on udev_device_get_sysattr_list_entry defining 'available' might be worth a try.

Comment 3 mulhern 2015-11-25 18:15:30 UTC
I don't think it would repay the effort, though.


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