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

fuzz: libFuzzer build failure "unexpected cfg condition value: max_level_*" #3424

Closed
dergoegge opened this issue Nov 26, 2024 · 4 comments · Fixed by #3431
Closed

fuzz: libFuzzer build failure "unexpected cfg condition value: max_level_*" #3424

dergoegge opened this issue Nov 26, 2024 · 4 comments · Fixed by #3431

Comments

@dergoegge
Copy link

Building the fuzz harnesses for fuzzing with libFuzzer is broken when using a recent rust nightly.

$ rustc --version
rustc 1.85.0-nightly (7db7489f9 2024-11-25)
$ RUSTFLAGS="--cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo +nightly fuzz build --features "libfuzzer_fuzz" msg_ping_target
...
error: unexpected `cfg` condition value: `max_level_debug`
   --> /workdir/rust-lightning/lightning-rapid-gossip-sync/src/processing.rs:447:6
    |
447 | /                     log_given_level!(
448 | |                         self.logger,
449 | |                         level,
450 | |                         "Failed to apply channel update: {:?}",
451 | |                         err
452 | |                     );
    | |_____________________^
    |
    = note: expected values for `feature` are: `criterion`, `default`, and `std`
    = help: consider adding `max_level_debug` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: this error originates in the macro `log_given_level` (in Nightly builds, run with -Z macro-backtrace for more info)
...
error: unexpected `cfg` condition value: `max_level_off`
   --> /workdir/rust-lightning/lightning-rapid-gossip-sync/src/processing.rs:466:3
    |
466 |         log_trace!(self.logger, "Done processing RGS data from {}", latest_seen_timestamp);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `criterion`, `default`, and `std`
    = help: consider adding `max_level_off` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: this error originates in the macro `$crate::log_given_level` which comes from the expansion of the macro `log_trace` (in Nightly builds, run with -Z macro-backtrace for more info)
...

I'm able to work around this with the following patch:

diff --git a/lightning-rapid-gossip-sync/Cargo.toml b/lightning-rapid-gossip-sync/Cargo.toml
index 03efbde3..fb01aba8 100644
--- a/lightning-rapid-gossip-sync/Cargo.toml
+++ b/lightning-rapid-gossip-sync/Cargo.toml
@@ -12,6 +12,13 @@ Utility to process gossip routing data from Rapid Gossip Sync Server.
 [features]
 default = ["std"]
 std = ["bitcoin-io/std", "bitcoin_hashes/std"]
+max_level_off = []
+max_level_error = []
+max_level_warn = []
+max_level_info = []
+max_level_debug = []
+max_level_trace = []
+

 [dependencies]
 lightning = { version = "0.0.124", path = "../lightning", default-features = false }
@tnull
Copy link
Contributor

tnull commented Nov 26, 2024

Ah, thank you very much for reporting this issue! Should be fixed by #3425.

@tnull
Copy link
Contributor

tnull commented Nov 27, 2024

As discussed in #3425, we might want to solve this by simply dropping the max_level_* features as probably ~no user is really interested in limiting the maximum level at compile time.

@enigbe, would you be interested to pick this up as part of your logging work? Only caveat would be that we'd likely want to ship it as part of the next release, which might get cut end of next week.

@tnull
Copy link
Contributor

tnull commented Nov 28, 2024

Now opened #3431.

@enigbe
Copy link

enigbe commented Nov 29, 2024

Apologies for missing this earlier @tnull, but I've notice you've created #3431. I'll add a review shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants