#26378 closed defect (fixed)

test_rust.sh fails on src/rust/crypto

Reported by: asn Owned by:
Priority: Very High Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: rust tor-tests
Cc: Actual Points:
Parent ID: Points: 1
Reviewer: isis Sponsor: SponsorV-can

Description

The latest travis builds fail on the rust tests after #26258 got merged (i guess). Here are some fails:

  --> external/crypto_digest.rs:74:1
   |
74 | const N_DIGEST_ALGORITHMS: usize = DIGEST_SHA3_512 as usize + 1;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

warning: type alias is never used: `smartlist_t`
   --> external/crypto_digest.rs:120:1
    |
120 | type smartlist_t = Stringlist;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: constant item is never used: `N_DIGEST_ALGORITHMS`
  --> external/crypto_digest.rs:74:1
   |
74 | const N_DIGEST_ALGORITHMS: usize = DIGEST_SHA3_512 as usize + 1;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(dead_code)] on by default

warning: type alias is never used: `smartlist_t`
   --> external/crypto_digest.rs:120:1
    |
120 | type smartlist_t = Stringlist;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    Finished dev [unoptimized + debuginfo] target(s) in 3.39 secs
     Running /home/travis/build/torproject/tor/tor-0.3.4.2-alpha-dev/_build/src/rust/target/debug/deps/external-99409f0e61b6d8c2

See https://api.travis-ci.org/v3/job/392350333/log.txt etc.

Child Tickets

Change History (14)

comment:1 Changed 15 months ago by catalyst

A little more info

   Compiling crypto v0.0.1 (file:///Users/tlyu/src/tor/src/rust/crypto)
error[E0277]: the trait bound `rngs::jitter::TimerError: std::error::Error` is not satisfied
   --> /Users/tlyu/src/tor/src/ext/rust/crates/rand-0.5.0-pre.2/src/rngs/jitter.rs:265:9
    |
265 |         Error::with_cause(ErrorKind::Unavailable,
    |         ^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `rngs::jitter::TimerError`
    |
    = note: required because of the requirements on the impl of `core::convert::From<rngs::jitter::TimerError>` for `alloc::boxed::Box<std::error::Error + core::marker::Send + core::marker::Sync + 'static>`
    = note: required because of the requirements on the impl of `core::convert::Into<alloc::boxed::Box<std::error::Error + core::marker::Send + core::marker::Sync + 'static>>` for `rngs::jitter::TimerError`
    = note: required by `rand_core::Error::with_cause`

I'm guessing some dependency of the rand crate needs updating.

comment:2 Changed 15 months ago by catalyst

Apparently rngs/jitter.rs in the rand crate won't build without --cfg std, and we set default-features = false for the rand crate in src/rust/crypto/Cargo.toml. Or it requires default-features = false for the rand_core crate as well for consistency.

There seems to be a possible linker error now in our digest crate, which I'm trying to track down.

comment:3 Changed 15 months ago by catalyst

The linker error seems to be

  = note: Undefined symbols for architecture x86_64:
            "_crypto_digest_get_digest", referenced from:
                external::crypto_digest::get_256_bit_digest::ha3da46ac36a82461 in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
                external::crypto_digest::get_512_bit_digest::h203eb3e5e9737026 in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
            "_crypto_digest_add_bytes", referenced from:
                external::crypto_digest::CryptoDigest::add_bytes::hb2bf5f14939f0d38 in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
            "_crypto_digest_new", referenced from:
                external::crypto_digest::CryptoDigest::new::h4cbcd63bf1a2cf1d in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
            "_crypto_digest256_new", referenced from:
                external::crypto_digest::CryptoDigest::new::h4cbcd63bf1a2cf1d in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
            "_crypto_digest512_new", referenced from:
                external::crypto_digest::CryptoDigest::new::h4cbcd63bf1a2cf1d in libexternal-8bb3f63f9ea96478.rlib(external-8bb3f63f9ea96478.3fgl34tvxe66etyo.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

comment:4 Changed 15 months ago by catalyst

This branch fixes the default-features = false inconsistency:
https://github.com/tlyu/tor/tree/bug26378

comment:5 Changed 15 months ago by catalyst

Summary: Travis fails on rust tests (test_rust.sh)test_rust.sh fails on src/rust/crypto

The linker error might not get fixed until we fix #25386. That might take a while, so maybe we have to not link any of the Rust digest stuff into tests until that gets fixed.

comment:6 Changed 15 months ago by isis

Reviewer: isis
Status: newneeds_review

comment:7 Changed 15 months ago by isis

Points: 1
Priority: MediumVery High
Sponsor: SponsorV-can
Status: needs_reviewmerge_ready

LGTM!

comment:8 Changed 14 months ago by nickm

Resolution: fixed
Status: merge_readyclosed

Merged to 0.3.4 and forward!

comment:9 Changed 14 months ago by nickm

Resolution: fixed
Status: closedreopened

comment:10 Changed 14 months ago by nickm

Status: reopenedneeds_review

I had to merge some other stuff to make the rand tests compile -- what do you think of my rust_rand_tests branch? Before I merged it, I got errors like:

   Compiling crypto v0.0.1 (file:///home/nickm/src/tor-034/src/rust/crypto)
error[E0468]: an `extern crate` loading macros must be at the crate root
  --> crypto/rand/mod.rs:14:1
   |
14 | extern crate tor_log;
   | ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `rand::ChaChaRng`
   --> crypto/rand/rng.rs:133:13
    |
133 |     pub use rand::ChaChaRng as TorRng;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ChaChaRng` in `rand`

error[E0432]: unresolved import `rand::ChaChaRng`
   --> crypto/rand/rng.rs:134:13
    |
134 |     pub use rand::ChaChaRng as TorStrongestRng;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ChaChaRng` in `rand`

comment:11 Changed 14 months ago by nickm

(This branch does not yet fix any linking issues wrt #25386)

comment:12 in reply to:  10 Changed 14 months ago by isis

Replying to nickm:

I had to merge some other stuff to make the rand tests compile -- what do you think of my rust_rand_tests branch? Before I merged it, I got errors like:

   Compiling crypto v0.0.1 (file:///home/nickm/src/tor-034/src/rust/crypto)
error[E0468]: an `extern crate` loading macros must be at the crate root
  --> crypto/rand/mod.rs:14:1
   |
14 | extern crate tor_log;
   | ^^^^^^^^^^^^^^^^^^^^^

error[E0432]: unresolved import `rand::ChaChaRng`
   --> crypto/rand/rng.rs:133:13
    |
133 |     pub use rand::ChaChaRng as TorRng;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^ no `ChaChaRng` in `rand`

error[E0432]: unresolved import `rand::ChaChaRng`
   --> crypto/rand/rng.rs:134:13
    |
134 |     pub use rand::ChaChaRng as TorStrongestRng;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ChaChaRng` in `rand`


LGTM!

comment:13 Changed 14 months ago by isis

Status: needs_reviewmerge_ready

comment:14 Changed 14 months ago by nickm

Resolution: fixed
Status: merge_readyclosed

Merged to 0.3.4 and forward!

Note: See TracTickets for help on using tickets.