Merge pull request #1795 from Abyss-W4tcher/dentry_names_forward_slashes

Linux: prevent "forward slashes only" dentry names
This commit is contained in:
ikelos
2025-05-08 23:12:11 +01:00
committed by GitHub
@@ -169,6 +169,7 @@ class LinuxUtilities(interfaces.configuration.VersionableInterface):
return ""
path_reversed = []
smeared = False
while (
dentry
and dentry.is_readable()
@@ -190,10 +191,16 @@ class LinuxUtilities(interfaces.configuration.VersionableInterface):
parent = dentry.d_parent
dname = dentry.d_name.name_as_str()
# empty dentry names are most likely
# the result of smearing
if not dname:
smeared = True
path_reversed.append(dname.strip("/"))
dentry = parent
path = "/" + "/".join(reversed(path_reversed))
if smeared:
return f"<potentially smeared> {path}"
return path
@classmethod