Skip to content
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

Update forkserver.rs #3138

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

Update forkserver.rs #3138

wants to merge 2 commits into from

Conversation

20urc3
Copy link
Contributor

@20urc3 20urc3 commented Apr 7, 2025

We're adding these comments in strategic spots where they'll be most useful - mainly at the public API boundaries like struct and function definitions. The style is concise but informative, focusing on explaining what each component does and how to use it properly.

I'm targeting places where a good comment saves users from having to dig through implementation details. The triple-slash style (///) ensures these show up in the generated documentation, making the library more approachable for new users.

The goal is to strike a balance - enough detail to be helpful without becoming overwhelming. Comments that focus on "why" and "how" tend to be more valuable than those that just restate what the code is doing.

We're adding these comments in strategic spots where they'll be most useful - mainly at the public API boundaries like struct and function definitions. The style is concise but informative, focusing on explaining what each component does and how to use it properly.
@tokatoka
Copy link
Member

tokatoka commented Apr 7, 2025

can you run fmt and clippy? then it's good

//! the program from scratch.
//!
//! Key features:
//! - Support for LibAFL (libafl_cc/libafl_cxx) instrumented binaries
Copy link
Member

Choose a reason for hiding this comment

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

... if they use the [whatever its name was] feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wdym exactly? :)

/// * `Result<(), Error>` - Always returns `Err` with a descriptive error message
/// that explains the failure and suggests possible solutions
///
/// # Error Codes
Copy link
Member

Choose a reason for hiding this comment

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

This does not return error codes but instead a string.
(Should these errors really return Error::unknown, though? Probably that should be more precise)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could:

  • Error::configuration() for map size issues
  • Error::compilation() for code compilation-related errors
  • Error::system() for system call failures
  • Error::version() for version incompatibility issues

Copy link
Member

Choose a reason for hiding this comment

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

///
/// Shared memory feature is also available, but you have to set things up in your code.
/// Please refer to AFL++'s docs. <https://github.com/AFLplusplus/AFLplusplus/blob/stable/instrumentation/README.persistent_mode.md>
/// # Type Parameters
Copy link
Member

Choose a reason for hiding this comment

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

I think if we start documenting type parameters, they will eventually be refactored and forgotten.
Instead we should document common letters for things in a common place, and drop it from this function.

@@ -769,7 +840,17 @@ where
}
}

/// The builder for `ForkserverExecutor`
/// Builder for `ForkserverExecutor` with a fluent interface for configuration
Copy link
Member

Choose a reason for hiding this comment

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

you could write

[`ForkserverExecutor`]

with brackets

/// The builder for `ForkserverExecutor`
/// Builder for `ForkserverExecutor` with a fluent interface for configuration
///
/// Provides methods to customize all aspects of forkserver execution:
Copy link
Member

Choose a reason for hiding this comment

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

forkserver instantiation

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.

3 participants