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

Kani not propagating goto-cc error code. #1563

Closed
YoshikiTakashima opened this issue Aug 20, 2022 · 7 comments
Closed

Kani not propagating goto-cc error code. #1563

YoshikiTakashima opened this issue Aug 20, 2022 · 7 comments
Assignees
Labels
[C] Bug This is a bug. Something isn't working.

Comments

@YoshikiTakashima
Copy link
Contributor

I tried this code: https://github.com/tokio-rs/prost.git
(commit 25d50ad325682cbc090fdc82686a03e52d4d4277)

using the following command line invocation:

cargo kani --workspace --all-features

with Kani version: 0.8 commit 90330b2

I expected to see this happen: If gotocc failed, then Kani should give nonzero error code

Instead, this happened: Message shows goto-cc failure, but kani-driver
is giving exit code 0.

This goes against UNIX standards, and will provide negative
experiences for customers who are using Kani via a script.

Suggested method of correction: propagate goto-cc's exit code as
cargo-kani's exit code when it is nonzero.

@YoshikiTakashima
Copy link
Contributor Author

YoshikiTakashima commented Aug 25, 2022

@adpaco-aws This issue has the risk of making stats over-optimistic wrt to milestone "Code generation succeeds on at least 80% of top 100 crates"

Until it is fixed, have the script look at the STDOUT/ERR. Exit code cannot be trusted.

@adpaco-aws
Copy link
Contributor

adpaco-aws commented Aug 25, 2022

Thanks @YoshikiTakashima , I wasn't aware of this issue but that explains why stats are not affected in #1585. Are you looking into this or should I take it?

@YoshikiTakashima
Copy link
Contributor Author

@adpaco-aws I am not looking into it right now. All of my time is taken up with #1312 and #1587

@adpaco-aws adpaco-aws moved this to In Progress in Kani 0.10 Aug 29, 2022
@adpaco-aws adpaco-aws self-assigned this Aug 29, 2022
@adpaco-aws
Copy link
Contributor

I haven't been able to reproduce this issue in my environment (Kani commit 42bfc94, Ubuntu 20.04). Running the same command on the same commit you posted gets me the following error:

[BUNCH OF WARNINGS]
   Compiling tests v0.0.0 (/home/ubuntu/prost/tests)
   Compiling tests-2015 v0.0.0 (/home/ubuntu/prost/tests-2015)
   Compiling tests-no-std v0.0.0 (/home/ubuntu/prost/tests-no-std)
error: failed to run custom build command for `tests-no-std v0.0.0 (/home/ubuntu/prost/tests-no-std)`

Caused by:
  process didn't exit successfully: `/home/ubuntu/prost/target/debug/build/tests-no-std-ac8c37a7962eca64/build-script-build` (exit status: 101)
  --- stdout
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/ident_conversion.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/nesting.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/recursive_oneof.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/custom_attributes.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/oneof_attributes.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/no_unused_results.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/default_enum_value.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/groups.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/deprecated_field.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/home/ubuntu/prost/target/x86_64-unknown-linux-gnu/debug/build/tests-no-std-de493d75f783c634/out/file_descriptor_set.bin" "-I" "../tests/src" "../tests/src/default_string_escape.proto"
  Running: "/usr/bin/protoc" "--include_imports" "--include_source_info" "-o" "/tmp/prost-buildXwkx3w/prost-descriptor-set" "-I" "../tests/src" "--experimental_allow_proto3_optional" "../tests/src/proto3_presence.proto"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "protoc failed: Unknown flag: --experimental_allow_proto3_optional\n" }', tests-no-std/../tests/src/build.rs:96:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `tests v0.0.0 (/home/ubuntu/prost/tests)`
[MORE ERRORS LIKE THIS, ALL PROPAGATE EXIT CODE 101]

In addition, I examined the stdout & stderr of the top100 crates experiment and couldn't find any error related to goto-cc. Are you running this on macOS? Can you post the error message you got from goto-cc if you have it?

@YoshikiTakashima
Copy link
Contributor Author

@adpaco-aws I've confirmed that kani's issues WRT prost is fixed.

Let us replicate a different way, we will force it to fail using a fake goto-cc that will always fail.

ytakashl@3c063046a79c kani-driver % grep -rn '"goto-cc"'
./src/call_goto_cc.rs:37:        let mut cmd = Command::new("goto-cc");
./src/call_goto_cc.rs:52:        let mut cmd = Command::new("goto-cc");

Change to

./src/call_goto_cc.rs:37:        let mut cmd = Command::new("false");
./src/call_goto_cc.rs:52:        let mut cmd = Command::new("false");

Replicated using:

ytakashl@3c063046a79c ~ % cargo build --workspace
ytakashl@3c063046a79c ~ % cd tests/cargo-kani/ws-flag
ytakashl@3c063046a79c ws-flag % cargo kani --only-codegen
   Compiling ws-flag v0.1.0 (/Users/ytakashl/Desktop/kani/tests/cargo-kani/ws-flag)
   Compiling libcrate v0.1.0 (/Users/ytakashl/Desktop/kani/tests/cargo-kani/ws-flag/libcrate)
    Finished dev [unoptimized + debuginfo] target(s) in 0.30s
ytakashl@3c063046a79c ws-flag % echo $?
0

@tedinski
Copy link
Contributor

tedinski commented Sep 2, 2022

--only-codegen doesn't call goto-cc

@adpaco-aws adpaco-aws moved this to In Progress in Kani 0.11 Sep 9, 2022
@adpaco-aws
Copy link
Contributor

--only-codegen doesn't call goto-cc

Right, --only-codegen stops after running symtab2gb on the project files since #1585.

Closing this because issues with prost are fixed now.

Repository owner moved this from In Progress to Done in Kani 0.10 Sep 13, 2022
Repository owner moved this from In Progress to Done in Kani 0.11 Sep 13, 2022
@tedinski tedinski added [C] Bug This is a bug. Something isn't working. and removed Cat: bug labels Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working.
Projects
No open projects
Status: Done
Status: Done
Development

No branches or pull requests

3 participants