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

Eliminate reliance on fs_extra; copy AFL++ directory with shell #506

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions cargo-afl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ edition = "2021"
[build-dependencies]
anyhow = { version = "1.0", features = ["backtrace"] }
clap = { version = "4.5", features = ["cargo", "derive"] }
fs_extra = "1.3"
home = "0.5"
rustc_version = "0.4"
tempfile = "3.10"
Expand All @@ -25,7 +24,6 @@ xdg = "2.5"
[dependencies]
anyhow = { version = "1.0", features = ["backtrace"] }
clap = { version = "4.5", features = ["cargo", "derive", "string"] }
fs_extra = "1.3"
home = "0.5"
rustc_version = "0.4"
tempfile = "3.10"
Expand Down
29 changes: 17 additions & 12 deletions cargo-afl/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,28 @@ pub fn config(args: &Args) -> Result<()> {
return Err(anyhow!("could not run 'git'"));
}
} else {
let _: u64 = fs_extra::dir::copy(
afl_src_dir,
tempdir.path(),
&fs_extra::dir::CopyOptions {
content_only: true,
..Default::default()
},
)?;
let success = Command::new("cp")
.args([
"-P", // preserve symlinks
"-R", // copy directories recursively
afl_src_dir_str,
&*tempdir.path().to_string_lossy(),
])
.status()
.as_ref()
.map_or(false, ExitStatus::success);
if !success {
return Err(anyhow!("could not copy directory {afl_src_dir:?}"));
}
}

let work_dir = tempdir.path();
let work_dir = tempdir.path().join(AFL_SRC_PATH);

build_afl(args, work_dir)?;
build_afl_llvm_runtime(args, work_dir)?;
build_afl(args, &work_dir)?;
build_afl_llvm_runtime(args, &work_dir)?;

if args.plugins {
copy_afl_llvm_plugins(args, work_dir)?;
copy_afl_llvm_plugins(args, &work_dir)?;
}

let afl_dir = common::afl_dir()?;
Expand Down
Loading