Skip to content

Fix #12002 (Filelister: Unclear error 'finding files failed (error: 3)')#5460

Merged
danmar merged 1 commit intocppcheck-opensource:mainfrom
cppchecksolutions:fix-12002
Sep 19, 2023
Merged

Fix #12002 (Filelister: Unclear error 'finding files failed (error: 3)')#5460
danmar merged 1 commit intocppcheck-opensource:mainfrom
cppchecksolutions:fix-12002

Conversation

@danmar
Copy link
Copy Markdown
Collaborator

@danmar danmar commented Sep 19, 2023

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator

LGTM.

The error code should be printed as a string as well. As I was not sure if we will ever hit this error so I did not add the functionality yet. I think it requires a call to Windows API function FormatMessage() which used to be a bit fiddly IIRC. Maybe there's an easier approach. It's been a while. I might do this with some strerror() change I have locally though.

@firewave
Copy link
Copy Markdown
Collaborator

FYI 3 is ERROR_PATH_NOT_FOUND.

So we either ignore this as the configuration might be a catch-all.
Or we report it as an proper error as it might be a configuration error and files are being omitted.

Either would make sense. I would go for the second option though.

Some short tests show that we ignore even no-existing files you specify on the command-line and only bail out when no file at all is found to analyze. Which is not optimal.

@danmar
Copy link
Copy Markdown
Collaborator Author

danmar commented Sep 19, 2023

The error code should be printed as a string as well.

Yes I would like that. But I don't know how to reproduce this issue and therefore I don't know how to test if it works.

I also looked at FormatMessage and it looks non-trivial to use to me.

@danmar
Copy link
Copy Markdown
Collaborator Author

danmar commented Sep 19, 2023

Either would make sense. I would go for the second option though.

Yes spontanously I also feel we should report it as a proper error. I want to understand what the problem is for the user though. Is it for some reason expected to skip some special folder..

At least the configuration did not look very strange to me at first glance.

@danmar danmar merged commit 3089fc3 into cppcheck-opensource:main Sep 19, 2023
@firewave
Copy link
Copy Markdown
Collaborator

It is just a missing path or a typo in it:

cppcheck somepath/*
[...]
cppcheck: finding files failed (error: 3)
cppcheck: error: could not find or open any of the paths given.

Yes spontanously I also feel we should report it as a proper error.

👍

I also looked at FormatMessage and it looks non-trivial to use to me.

I can take a look.

@danmar danmar deleted the fix-12002 branch October 5, 2023 16:22
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