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

contextpatch: neglect blank rows #20

Closed
wants to merge 1 commit into from

Conversation

qlenlen
Copy link
Contributor

@qlenlen qlenlen commented Jul 4, 2024

error:
Traceback (most recent call last):
File "run.py", line 1924, in
File "run.py", line 557, in main
File "run.py", line 628, in project
File "run.py", line 1264, in packChoo
File "run.py", line 1480, in inpacker
File "contextpatch.py", line 101, in main
File "contextpatch.py", line 26, in scan_context
ValueError: not enough values to unpack (expected at least 1, got 0)
[143640] Failed to execute script 'run' due to unhandled exception!

cause:
def scan_context(file) -> dict: # 读取context文件返回一个字典
context = {}
with open(file, "r", encoding='utf-8') as file_:
for i in file_.readlines():
filepath, *other = i.strip().split()
...
return context
filepath, *other = i.strip().split(): i may read a blank line.

for example, someone may manually add selinux rules and leave a blank line, then error occurs.
/vendor/tee u:object_r:tee_file:s0
/vendor/tee/driver u:object_r:tee_file:s0
/vendor/vm-system u:object_r:same_process_hal_file:s0

/vendor/lib/(.)?.so u:object_r:same_process_hal_file:s0
/vendor/lib/egl/(.
)?.so u:object_r:same_process_hal_file:s0

@qlenlen qlenlen closed this Jul 4, 2024
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.

1 participant