From 7e6b7cb50b041f7cb8cd5507d65ba514a43ce95e Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 30 Jan 2026 18:34:39 +0100 Subject: [PATCH] Improve path readability check (#2967) On modern system e.g. render nodes are made accessible via the udev uaccess functionality, which adds the logged in user to the ACL of the device. This means just checking for user and group is bound to give false positives. Instead use os.access as a first check Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- projects/amdsmi/amdsmi_cli/amdsmi_helpers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py index a58ed219be..564bdf7298 100755 --- a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py @@ -1358,6 +1358,11 @@ class AMDSMIHelpers(): if os.geteuid() == 0: return True, None, None + # Use os.access to check read permission (including ACLs), so that + # permissions granted via mechanisms like udev/uaccess are respected. + if os.access(path, os.R_OK): + return True, None, None + mode = st.st_mode uid = st.st_uid gid = st.st_gid