Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pranlawate
Copy link
Contributor

When we run commands with flags/options that can optionally take argument value like -t, -r, etc. along with policy file. It breaks the behavior because the entire policy file path is wrongly taken as value for the argument before it.

seinfo -t /path/to/policy.33 -> will take /path/to/policy.33 as string argument for -t and show 0 results, when it should show all types without any string argument filtering from the policy.

The workaround is
seinfo /path/to/policy.33 -t

I have added a fix to ensure the we check the argument followed by any of the args in 'queries' when args.policy is not detected already. Then verify the next argument is a valid path , if yes then add it to args.policy otherwise it's an argument value. Since there are not args which actually take a path, my fix should work properly.
I have tested it for -t with policy, without policy , with value and policy, with value and no policy. Similarly have tested -r and -a for all 4 combinations.

@pranlawate pranlawate force-pushed the fix-seinfo-policy-arg-parsing branch from 4e07800 to a33a2e3 Compare October 1, 2025 18:30
@pebenito pebenito merged commit d575f0b into SELinuxProject:main Oct 2, 2025
9 checks passed
@pranlawate pranlawate deleted the fix-seinfo-policy-arg-parsing branch October 2, 2025 17:23
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

Successfully merging this pull request may close these issues.

2 participants