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

fixing malparsed windows paths #4374

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion analyzer/codechecker_analyzer/buildlog/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ def extend_compilation_database_entries(compilation_database):
source_files = []
source_dir = entry['directory']

options = shlex.split(entry['command'])
options = shlex.split(entry['command'], posix=(os.name=='posix'))
Copy link

@marc-h38 marc-h38 Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The posix= parameter is designed to manage nuances between different Unix shells, so it's very mysterious how this helps with Windows and why?!

I realize this is still just a draft, but some... draft comments and a commit message draft would not hurt.

Generally speaking, shlex is NOT meant to help prepare Windows commands ("outputs"). According to its documentation, it's meant as a convenience to help parsing inputs to the program, like a simple configuration file or some parameters.
https://docs.python.org/3/library/shlex.html

Longer example of shlex abuse and Windows compatibility story in zephyrproject-rtos/west@94f8a04

for opt in options:
if opt.startswith('@'):
response_file = os.path.join(source_dir, opt[1:])
Expand Down