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

Add transitional message #348

Merged
merged 2 commits into from
Jun 28, 2023
Merged

Add transitional message #348

merged 2 commits into from
Jun 28, 2023

Conversation

smoelius
Copy link
Member

@smoelius smoelius commented Jun 27, 2023

This PR implements a transitional message as described in #335.

Essentially, users should now be able to install the cargo-afl binary with either of the following commands:

cargo install afl       # old command
cargo install cargo-afl # new command

However, using the old command now produces the following warning:

warning: You appear to be installing `cargo-afl` with:
warning:     cargo install afl
warning: A future version of afl.rs will require you to use:
warning:     cargo install cargo-afl
warning: You can use the new command now, if you like.

This PR also resolves #330.

@smoelius smoelius force-pushed the transition branch 5 times, most recently from 6acf255 to f15968d Compare June 27, 2023 17:00
Copy link

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

LGTM; two tiny questions!

afl/build.rs Outdated
Comment on lines 28 to 34
if installing && !building_cargo_afl {
println!("cargo:warning=You appear to be installing `cargo-afl` with:");
println!("cargo:warning= cargo install afl");
println!("cargo:warning=A future version of afl.rs will require you to use:");
println!("cargo:warning= cargo install cargo-afl");
println!("cargo:warning=You can use the new command now, if you like.");
}

Choose a reason for hiding this comment

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

Does it make sense to also suggest cargo uninstall afl, or is the latter cargo-afl going to effectively clobber the install anyways?

Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than suggest to uninstall, I propose the following. Change the first line to:

warning: You appear to be installing the `cargo-afl` binary with:

And add the following line at the end:

warning: Note: If the binary is already installed, you may need to add --force.

So the revised message would look like:

warning: You appear to be installing the `cargo-afl` binary with:
warning:     cargo install afl
warning: A future version of afl.rs will require you to use:
warning:     cargo install cargo-afl
warning: You can use the new command now, if you like.
warning: Note: If the binary is already installed, you may need to add --force.

What do you think?

Choose a reason for hiding this comment

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

Sounds good to me!

Comment on lines +68 to +69
#[cfg(unix)]
let _file = sys::lock_path(&work_dir).unwrap();

Choose a reason for hiding this comment

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

Just making sure I understand: this doesn't require an associated flock(..., LOCK_UN) because you're expecting the advisory lock to be dropped when the underlying fd is closed at process exit, right?

I believe that should be fine, but it's not super well defined by POSIX AFAICT. Just something to be aware of should it cause unusual behavior on non-Linux builds in the future 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Just making sure I understand: this doesn't require an associated flock(..., LOCK_UN) because you're expecting the advisory lock to be dropped when the underlying fd is closed at process exit, right?

That's correct.

I believe that should be fine, but it's not super well defined by POSIX AFAICT. Just something to be aware of should it cause unusual behavior on non-Linux builds in the future 🙂

I'm curious as to what makes you say that (not saying you're wrong).

I'm reading this: https://man7.org/linux/man-pages/man2/flock.2.html

Furthermore, the lock is released
either by an explicit LOCK_UN operation on any of these duplicate
file descriptors, or when all such file descriptors have been
closed.

Is file descriptor closure not well defined?

Choose a reason for hiding this comment

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

Is file descriptor closure not well defined?

I thought POSIX was ambiguous on whether process termination is actually required to close all FDs, but it looks like it's unambiguous:

All of the file descriptors, directory streams, conversion descriptors, and message catalog descriptors open in the calling process shall be closed.

(From https://pubs.opengroup.org/onlinepubs/007904875/functions/exit.html)

There's some subtlety around child processes that inherit the open FD, but I don't think that case matters here. So this is safe to ignore 🙂

@smoelius
Copy link
Member Author

Thanks a lot for the review, @woodruffw. 🙏

@smoelius smoelius merged commit e6a6475 into master Jun 28, 2023
18 checks passed
@smoelius smoelius deleted the transition branch June 28, 2023 18:11
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.

Need install test
2 participants