3

Expand `CARGO` environment variable at runtime by smoelius · Pull Request #184 ·...

 2 years ago
source link: https://github.com/rust-fuzz/afl.rs/pull/184
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Member

Author

smoelius commented on Aug 29, 2021

This script reproduces the bug:

#! /bin/bash

set -x

rm -rf $HOME/tmp/cargo
rm -rf $HOME/tmp/afl.rs
rm -rf $HOME/tmp/afl.rs-fix

git clone https://github.com/rust-lang/cargo --branch 0.55.0 --recursive $HOME/tmp/cargo
git clone https://github.com/rust-fuzz/afl.rs --branch 0.10.1 --recursive $HOME/tmp/afl.rs
git clone https://github.com/smoelius/afl.rs --branch master --recursive $HOME/tmp/afl.rs-fix

cd $HOME/tmp/cargo
cargo build
cargo run -- install --force --path $HOME/tmp/afl.rs
cargo afl not-a-subcommand
cargo clean
cargo afl not-a-subcommand

If you run it, you'll see the following before the cargo clean:

error: no such subcommand: `not-a-subcommand`

And the following after:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/bin/cargo-afl.rs:357:10

This is because cargo clean is blowing away the cargo binary used to install afl.rs.

If you then change afl.rs to afl.rs-fix in the cargo install line, you'll instead see two no such subcommand messages.

@disconnect3d Could you please verify when you have a chance? I'll then merge.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK