Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Bump clap in proxy to 4.0 #2855

Merged
merged 3 commits into from
Feb 19, 2023
Merged

Bump clap in proxy to 4.0 #2855

merged 3 commits into from
Feb 19, 2023

Conversation

Porges
Copy link
Member

@Porges Porges commented Feb 16, 2023

Required work for #2277.

@Porges Porges changed the title Bump clap proxy Bump clap in proxy to 4.0 Feb 16, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2023

Codecov Report

Merging #2855 (810e70e) into main (1ac3fd4) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #2855      +/-   ##
==========================================
+ Coverage   28.08%   28.09%   +0.01%     
==========================================
  Files         302      302              
  Lines       35653    35629      -24     
==========================================
- Hits        10012    10011       -1     
+ Misses      25641    25618      -23     
Impacted Files Coverage Δ
src/ApiService/ApiService/OneFuzzTypes/Enums.cs 32.39% <ø> (ø)
src/ApiService/ApiService/OneFuzzTypes/Model.cs 69.62% <ø> (+0.04%) ⬆️
src/ApiService/ApiService/onefuzzlib/Config.cs 0.00% <ø> (ø)
src/ApiService/ApiService/onefuzzlib/Defs.cs 0.00% <ø> (ø)
src/agent/coverage/src/allowlist.rs 76.99% <ø> (+3.26%) ⬆️
src/agent/coverage/src/binary.rs 47.19% <ø> (+3.44%) ⬆️
src/agent/onefuzz-task/src/local/coverage.rs 0.00% <ø> (ø)
...c/agent/onefuzz-task/src/tasks/coverage/generic.rs 0.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Porges Porges enabled auto-merge (squash) February 19, 2023 19:56
@Porges Porges merged commit 1b07b7d into main Feb 19, 2023
@Porges Porges deleted the bump-clap-proxy branch February 19, 2023 21:17
Porges added a commit that referenced this pull request Feb 19, 2023
A Friday afternoon jaunt.

To be merged after #2855; does the remaining work to close #2277 (and closes off some things that Dependabot was trying to upgrade).

Tested by manually running the commands; we don't have good coverage for this kind of stuff. OTOH, most of these commands are for the experimental local fuzzing mode, which is not fully supported yet. I did specifically test the `onefuzz-task managed` command which is the one used in production.

## Details

- Bump `clap` to 4.1.6
  - Remove `structopt` as this is subsumed by clap now
- Bump `envlogger` to 0.10 (removes problematic dependency)
- Set `default-features=false` on `proc-maps` (removes a feature which is only needed to support FreeBSD), and bump it to 0.3

The main changes migrating `clap` are:

- `value_t!` is gone; now use `matches.get_one::<T>`. If `T` is not `String` then a parser must have been registered on the `Arg` when it was created, with `arg.value_parser(value_parser!(T))`.
- `Command::with_name` and `Arg::with_name` are now called `new`.
- `Command` and `Subcommand` were unified, and `App` is removed.
- `arg.takes_value(true)` is gone; it is the default. For flags use `arg.action(ArgAction::SetTrue)` and then retrieve the flag value with `matches.get_flag`.

This code would be simplified a lot by using the `clap::Parser` on structs, but that requires reworking the code significantly as we cannot dynamically add/remove arguments the way that this is currently done.

## Also found

Found one bug while manually testing the `onefuzz-task local` commands; see comment below.
@mgreisen mgreisen mentioned this pull request Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants