Skip to content

fix #13968: Addon execution fails for some paths with spaces on Windows #7632

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ludviggunne
Copy link
Collaborator

No description provided.

@ludviggunne ludviggunne force-pushed the 13968 branch 2 times, most recently from 205ad6f to 8ecd18f Compare June 27, 2025 09:24
ec = 1 if os.name == 'nt' else 127

# Make sure the full command is used
assert 'The system cannot find the path specified. [internalError]' in stderr
Copy link
Owner

Choose a reason for hiding this comment

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

I don't really understand this test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Without the fix, the error is similar to the one in the ticket, i.e. the part before the whitespace is interpreted as a command, and the rest of the path it's argument(s).


#ifdef _WIN32
cmd = "\"" + cmd + "\"";
Copy link
Owner

Choose a reason for hiding this comment

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

spontanously this looks wrong to me. If cmd is:

"C:\Program Files\Cppcheck Premium\premiumaddon.exe" --cli foo.c.dump

then here it is changed to:

""C:\Program Files\Cppcheck Premium\premiumaddon.exe" --cli foo.c.dump"

so if the initial "" are removed then that is:

C:\Program Files\Cppcheck Premium\premiumaddon.exe" --cli foo.c.dump"

Is this intended behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In what situation would the "" be removed?

Copy link
Owner

@danmar danmar Jun 27, 2025

Choose a reason for hiding this comment

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

hmm.. I believe that "" means nothing in the command processor?

I assume that a command ""C:\Program Files\Cppcheck Premium\premiumaddon.exe" --cli foo.c.dump" would fail if I execute it in a windows command terminal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Windows command line seems to parse quotations differently: https://stackoverflow.com/a/6378038

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