Skip to content

fix(cli): pass long-opt ids into parse_unsigned for threads/subsample/cpumask - #1712

Merged
nilfm99 merged 5 commits into
Netflix:masterfrom
mangeshraut712:fix/cli-parse-unsigned-opt-ids
Nov 16, 2026
Merged

nilfm99 merged 5 commits into
Netflix:masterfrom
mangeshraut712:fix/cli-parse-unsigned-opt-ids

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Summary

Invalid values for --threads, --subsample, and --cpumask made vmaf abort instead of printing the usual Invalid argument message. Those three cases passed short option characters into parse_unsigned, so error() could not find them in long_opts.

Pass ARG_THREADS, ARG_SUBSAMPLE, and ARG_CPUMASK, matching --gpumask / --frame_cnt.

Fixes #1694

Test plan

  • vmaf ... --threads abc prints Invalid argument (no abort)
  • same for --subsample abc and --cpumask abc
  • valid integer values still work

…/cpumask

Passing short option characters made error() walk off long_opts and abort
on invalid values. Match gpumask/frame_cnt by using ARG_THREADS,
ARG_SUBSAMPLE, and ARG_CPUMASK.

Fixes Netflix#1694
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Tiny CLI parse fix for #1694 — three ARG_* ids so invalid --threads/--subsample/--cpumask print Invalid argument instead of aborting. Happy to revise.

Exercise malformed --threads, --subsample and --cpumask values through the
real executable, checking normal usage errors instead of process aborts.
Preserve zero, decimal and hexadecimal parsing coverage in the C suite.

AI-assisted regression coverage. Verified against each original option-ID
mutation and the full native libvmaf test suite.
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Could a maintainer authorize the pending workflows for current head 36af8148b6029a3b06e1b8c93f3f2755d5eec8c9? checkasm, ffmpeg report action_required, so hosted validation has not run. Please let me know if any contributor-side changes are needed before authorization or review.

@nilfm99

nilfm99 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the patch, the fix looks correct. I'd prefer not to add this ad-hoc Python harness and meson.build addition though, we could consider a broader CLI argument error coverage separately, instead of an ad-hoc test for these three cases. Could you reduce the patch to just the 3-line fix?

@nilfm99

nilfm99 commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Also, please ignore the windows CI failure, I have an open workaround (#1722) but will wait to see if the upstream package maintainer can provide a checksum to fix it properly.

Drop ad-hoc Python harness and test additions per maintainer review from
@nilfm99, keeping strictly the 3-line CLI argument parse fix for
ARG_THREADS, ARG_SUBSAMPLE, and ARG_CPUMASK.
@mangeshraut712

Copy link
Copy Markdown
Contributor Author

Thanks @nilfm99! Updated head to b65bff0 to reduce the patch to strictly the 3-line fix in libvmaf/tools/cli_parse.c, removing the ad-hoc Python test harness and Meson build additions.

@nilfm99
nilfm99 merged commit a599b2b into Netflix:master Nov 16, 2026
17 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.

vmaf CLI aborts on a non-integer value for --threads, --subsample or --cpumask

2 participants