Skip to content

cli: honor -w/--no-warnings for the file-too-large skip message#2219

Merged
plusvic merged 1 commit into
VirusTotal:masterfrom
munzzyy:fix-no-warnings-file-too-large
Jul 6, 2026
Merged

cli: honor -w/--no-warnings for the file-too-large skip message#2219
plusvic merged 1 commit into
VirusTotal:masterfrom
munzzyy:fix-no-warnings-file-too-large

Conversation

@munzzyy

@munzzyy munzzyy commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #2137.

-w/--no-warnings skips every other warning in cli/yara.c but not the "skipping X because it's larger than N bytes" message from scan_dir. That one's printed unconditionally on both the POSIX and Windows code paths, so -w -z <size> still spams stderr with a line per oversized file.

Wrapped both prints in if (!ignore_warnings), same flag and same pattern already used for the other warnings in this file (e.g. the CALLBACK_MSG_TOO_SLOW_SCANNING / CALLBACK_MSG_TOO_MANY_MATCHES cases). No behavior change to which files get scanned, just the message.

Didn't have a build toolchain handy to test this on, but it's a one-line else -> else if (!ignore_warnings) in each of the two scan_dir implementations (Unix and Windows), matching the guard style already used three other times in this same file.

scan_dir() prints "skipping <file> ... because it's larger than N
bytes" unconditionally on both the POSIX and Windows paths, ignoring
ignore_warnings even though every other warning in this file checks
it. Guard both prints the same way the other warnings already are.

Fixes VirusTotal#2137
@google-cla

google-cla Bot commented Jul 4, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@plusvic
plusvic merged commit c125ac7 into VirusTotal:master Jul 6, 2026
14 checks passed
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.

When using the -z option, the -w option does not disable warnings about files skipped due to them being larger than the maximum file size

2 participants