Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ls_parser throws exception "ValueError: invalid literal for int() with base 10: '?' for line result["size"] = int(size)" #3627

Open
huali027 opened this issue Dec 13, 2022 · 0 comments

Comments

@huali027
Copy link
Contributor

It is found with the spec "ls -lZ /var/lib/rsyslog", the output of the spec is

-rw------- 1 root root ? 125 Dec 11 01:04 imjournal.state

The archive is from RHEL8 host, but the selinux context does not display, it shows as "?", so the workflow of the following code block is messy due to the "?":

            if parts[1][0].isdigit():
                # We have to split the line again to see if this is a RHEL8
                # selinux stanza. This assumes that the context section will
                # always have at least two pieces separated by ':'.
                if ":" in line.split()[4]:
                    rest = parse_rhel8_selinux(parts[1:])
                else:
                    rest = parse_non_selinux(parts[1:])
            else:
                rest = parse_selinux(parts[1:])

It enters the parse_non_selinux function since there is no colon in the SELinux context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant