Repository: microsoft/onefuzz
File: src/agent/onefuzz-task/src/tasks/analysis/generic.rs (Rust)

Code before:
        }
    }

    Ok(())
}

async fn _copy(input_url: BlobUrl, destination_folder: &OwnedDir) -> Result<PathBuf> {
    let file_name = input_url.name();
    let mut destination_path = PathBuf::from(destination_folder.path());
    destination_path.push(file_name);
    match input_url {
        BlobUrl::AzureBlob(input_url) => {
            az_copy::copy(input_url.as_ref(), &destination_path, false).await?
        }
        BlobUrl::LocalFile(path) => {
            tokio::fs::copy(path, &destination_path).await?;
        }
    }
    Ok(destination_path)
}
pub async fn run_tool(
    input: impl AsRef<Path>,
    config: &Config,
    reports_dir: &Option<PathBuf>,
) -> Result<()> {
    let target_exe = config.common.setup_dir.join(&config.target_exe);

    let expand = Expand::new()
        .machine_id()
        .await?
        .input_path(&input)
        .target_exe(&target_exe)
        .target_options(&config.target_options)
        .analyzer_exe(&config.analyzer_exe)
        .analyzer_options(&config.analyzer_options)
        .output_dir(&config.analysis.local_path)
        .tools_dir(&config.tools.local_path)
        .setup_dir(&config.common.setup_dir)
        .job_id(&config.common.job_id)
        .task_id(&config.common.task_id)
        .set_optional_ref(&config.common.microsoft_telemetry_key, |tester, key| {
            tester.microsoft_telemetry_key(key)
        })
        .set_optional_ref(&config.common.instance_telemetry_key, |tester, key| {
            tester.instance_telemetry_key(key)
        })
        .set_optional_ref(reports_dir, |tester, reports_dir| {
            tester.reports_dir(reports_dir)
        })
        .set_optional_ref(&config.crashes, |tester, crashes| {
            tester

Review comment (bug):
To avoid the upgrade breakage described in the PR message, we could temporarily guard this `.join()` on a call to `.starts_with("setup/")`. This does have some edge cases, though, e.g. if a user had a `setup` container which had a nested `target_exe` that (abstractly) resided in `{setup_dir}/setup/fuzz.exe`.

Code after:
            }
        }
    }

    Ok(())
}

async fn _copy(input_url: BlobUrl, destination_folder: &OwnedDir) -> Result<PathBuf> {
    let file_name = input_url.name();
    let mut destination_path = PathBuf::from(destination_folder.path());
    destination_path.push(file_name);
    match input_url {
        BlobUrl::AzureBlob(input_url) => {
            az_copy::copy(input_url.as_ref(), &destination_path, false).await?
        }
        BlobUrl::LocalFile(path) => {
            tokio::fs::copy(path, &destination_path).await?;
        }
    }
    Ok(destination_path)
}
pub async fn run_tool(
    input: impl AsRef<Path>,
    config: &Config,
    reports_dir: &Option<PathBuf>,
) -> Result<()> {
    let target_exe =
        try_resolve_setup_relative_path(&config.common.setup_dir, &config.target_exe).await?;

    let expand = Expand::new()
        .machine_id()
        .await?
        .input_path(&input)
        .target_exe(&target_exe)
        .target_options(&config.target_options)
        .analyzer_exe(&config.analyzer_exe)
        .analyzer_options(&config.analyzer_options)
        .output_dir(&config.analysis.local_path)
        .tools_dir(&config.tools.local_path)
        .setup_dir(&config.common.setup_dir)
        .job_id(&config.common.job_id)
        .task_id(&config.common.task_id)
        .set_optional_ref(&config.common.microsoft_telemetry_key, |tester, key| {
            tester.microsoft_telemetry_key(key)
        })
        .set_optional_ref(&config.common.instance_telemetry_key, |tester, key| {
            tester.instance_telemetry_key(key)
        })
        .set_optional_ref(reports_dir, |tester, reports_dir| {
            tester.reports_dir(reports_dir)
        })