insights-core
insights-core copied to clipboard
`ls_parser` parses data incorrectly in case of broken symlinks
The _load(self)
method of the Directory(dict)
class in the insights-core/insights/core/ls_parser.py
is unable to parse the broken symlinks correctly when using the ls -lanRL
command.
Example:
[root@jobselko /]# ls -lan /run/systemd/units
total 0
drwxr-xr-x. 2 0 0 60 Jun 29 06:53 .
drwxr-xr-x. 16 0 0 400 Jun 28 06:40 ..
lrwxrwxrwx. 1 0 0 32 Jun 28 06:40 invocation:auditd.service -> ad92564f4a9e4fd8a7a77bb00dbd2ab9
[root@jobselko /]# ls -lanL /run/systemd/units
ls: cannot access '/run/systemd/units/invocation:auditd.service': No such file or directory
total 0
drwxr-xr-x. 2 0 0 60 Jun 29 06:53 .
drwxr-xr-x. 16 0 0 400 Jun 28 06:40 ..
l?????????? ? ? ? ? ? invocation:auditd.service
Parsed result:
'? ? invocation:auditd.service': {'type': 'l', 'perms': '??????????', 'owner': '?', 'group': '?', 'se_user': '?', 'se_role': None, 'se_type': None, 'se_mls': None, 'name': '? ? invocation:auditd.service', 'raw_entry': 'l?????????? ? ? ? ? ? invocation:auditd.service', 'dir': '/etc/systemd/system'}