Skip to content

cargo clean required between cargo kani invocations #1591

Closed

Description

@zhassan-aws

I often run into issues when rerunning cargo kani without doing cargo clean in between.

One of the issues is the Error: Conflicting proof harnesses named ... error. I could reproduce through updating the dependencies or through adding a lib crate to a bin crate.

For example:

  1. cargo new --lib foo
  2. cd foo
  3. Replace the contents of src/lib.rs with:
#[kani::proof]
fn check() {
    assert!(1 + 1 == 2);
}
  1. Run cargo kani --harness check
  2. Add a dependency to Cargo.toml, e.g.:
[dependencies]
bitflags = "1.3.2"
  1. Rerun cargo kani --harness check

This produces:

   Compiling bitflags v1.3.2
   Compiling foo v0.1.0 (/home/ubuntu/examples/conflicting/tmp/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
Error: Conflicting proof harnesses named check:
 check
 check

The same error can be reproduced through creating a binary crate, runing cargo kani --harness check, adding a src/lib.rs file, and rerunning cargo kani --harness check.

This error does not occur if I cargo clean in between the two cargo kani invocations.

Apparently, the modification (adding a dependency or adding a module) results in changing the checksum, so the metadata files do not get overwritten. With both metadata files lying around, the Kani driver thinks that there are duplicate harnesses.

Activity

  1. added
    [C] Bug
    on Aug 26, 2022
  2. zhassan-aws commented on Aug 26, 2022

    @zhassan-aws
    ContributorAuthor

    If I invoke cargo kani without --harness but edit the harness body in between invocations, I get an error in CBMC instead (the same error in #1448).

  3. zhassan-aws commented on Aug 26, 2022

    @zhassan-aws
    ContributorAuthor

    The root cause of both issues is that the Kani driver collects the symtab and metadata files through a * glob.

  4. changed the title [-]cargo clean required between cargo kani invokations[/-] [+]cargo clean required between cargo kani invocations[/+] on Aug 26, 2022
  5. tedinski commented on Aug 29, 2022

    @tedinski
    Contributor
  6. jaisnan commented on Aug 29, 2022

    @jaisnan
    Contributor

    Also another side effect of this issue, the output from cargo kani repeats itself without cargo clean before invocations.

  7. added
    T-High Priority
    on Oct 13, 2022
  8. tedinski commented on Oct 13, 2022

    @tedinski
    Contributor

    Upped priority. Customers seem to hit this often...

  9. celinval commented on Nov 9, 2022

    @celinval
    Contributor

    This has been fixed by #1847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-High Priority[C] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions