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 1302359 - udev_device_get_sysattr_value () does not consistently return contents of sys attribute file
Summary: udev_device_get_sysattr_value () does not consistently return contents of sys...
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
unspecified
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-27 15:28 UTC by mulhern
Modified: 2020-12-15 07:39 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-12-15 07:39:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Simple reproducer that works on my machine for this particular boot. (1.60 KB, text/plain)
2016-01-27 15:28 UTC, mulhern
no flags Details

Description mulhern 2016-01-27 15:28:08 UTC
Created attachment 1118822 [details]
Simple reproducer that works on my machine for this particular boot.

Description of problem:

udev_device_get_sysattr_value() is defined to return the contents of a sys attr file. In some cases, it doesn't.

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

219

How reproducible:

Consistently, for the particular devices and attributes chosen. It is not clear what it is about the particular attribute file that causes the behavior.

Steps to Reproduce:
1. My reproducer contains two examples of devices that behave differently.
2. Run the reproducer. Note that both devices have vpg_pg83 attribute files that are non-empty (wc claims that both contain characters, and cat echos random glyphs to the terminal in both cases).
3. Note that in one case, the result of calling udev_deivce_get_sysattr_value is the empty string and that in the other case it is a non-empty string.

Actual results:

Inconsistent behavior in reading non-empty vpg_pg83 attribute file for different devices.

Expected results:

Well-documented consistency.

Additional info:

I think this also affects the behavior of udevadm info --attribute-walk for these devices. AFAIU, udevadm is defined not to show binary attributes, restricting itself to those that are matched in udev rules. For the device where the method returns a non-empty string, udevadm does not show a corresponding vpd_pg83 attribute. For the device where the function mistakenly returns an empty string, udevadm does show the attribute, apparently interpreting it, since empty, as matchable text.

Comment 2 mulhern 2016-01-27 16:48:26 UTC
It looks like the value stops at the first 0x00 character. 
In my reproducer, with the device that returns a non-empty string, only part of the data is returned, since the null character occurs after two characters. With the device that returns an empty string, the null character is the first character, so the empty string is returned.

Comment 3 Gris Ge 2017-02-16 13:54:40 UTC
Mulhern,

IMHO, this is not a bug, by definition of udev_device_get_sysattr_value(), it returns a string, so truncate after first \0 found is reasonable. 
In case of reading file like vpd83, you could manually read it or ask udev team to create new function like 
'udev_device_get_sysattr_value_raw(struct udev_device *udev_device, const char *sysattr, uint8_t *buff, size_t buff_max_size))'.

Comment 4 Gris Ge 2017-02-16 13:56:20 UTC
Sorry, I missed the part you are asking for consistency. Please ignore my previous comment.

Comment 7 RHEL Program Management 2020-12-15 07:39:52 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


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