pingora icon indicating copy to clipboard operation
pingora copied to clipboard

sfv 0.11 breaks pingora cargo build

Open BSteffaniak opened this issue 9 months ago • 5 comments

Describe the bug

sfv was recently updated to 0.11 and now cargo build in the pingora root fails with this error:

    Checking pingora-core v0.4.0 (/home/braden/GitHub/pingora/pingora-core)
error[E0308]: mismatched types
   --> pingora-core/src/protocols/http/compression/mod.rs:416:39
    |
416 |         match sfv::Parser::parse_list(ac.as_bytes()) {
    |               ----------------------- ^^^^^^^^^^^^^ expected `Parser<'_>`, found `&[u8]`
    |               |
    |               arguments to this function are incorrect
    |
note: method defined here
   --> /home/braden/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/sfv-0.11.0/src/parser.rs:166:12
    |
166 |     pub fn parse_list(self) -> SFVResult<List> {
    |            ^^^^^^^^^^

error[E0277]: the trait bound `protocols::http::compression::Algorithm: std::convert::From<&sfv::TokenRef>` is not satisfied
   --> pingora-core/src/protocols/http/compression/mod.rs:422:45
    |
422 | ...                   let algorithm = Algorithm::from(s);
    |                                       ^^^^^^^^^ the trait `std::convert::From<&sfv::TokenRef>` is not implemented for `protocols::http::compression::Algorithm`
    |
    = help: the trait `From<&sfv::TokenRef>` is not implemented for `protocols::http::compression::Algorithm`
            but trait `From<&str>` is implemented for it
    = help: for that trait implementation, expected `str`, found `sfv::TokenRef`

error[E0277]: the trait bound `protocols::http::compression::Algorithm: std::convert::From<&sfv::TokenRef>` is not satisfied
   --> pingora-core/src/protocols/http/compression/mod.rs:425:43
    |
425 | ...                   list.push(Algorithm::from(s));
    |                                 ^^^^^^^^^ the trait `std::convert::From<&sfv::TokenRef>` is not implemented for `protocols::http::compression::Algorithm`
    |
    = help: the trait `From<&sfv::TokenRef>` is not implemented for `protocols::http::compression::Algorithm`
            but trait `From<&str>` is implemented for it
    = help: for that trait implementation, expected `str`, found `sfv::TokenRef`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `pingora-core` (lib) due to 3 previous errors

Pingora info

Pingora version: caa6a0879e41d45b9d2798d9791a981c7a45de5c Rust version: cargo 1.85.1 (d73d2caf9 2024-12-31) Operating system version: nixos

Steps to reproduce

Checkout latest main and run cargo build

Expected results

The crate should build successfully

Observed results

The above error output

BSteffaniak avatar Mar 26 '25 01:03 BSteffaniak

This submission causes a build error in pingora. it is not a good idea: sfv ="0". https://github.com/undef1nd/sfv/commit/45bd84f2843996d07369da66213e1288da225de6

kingzcheung avatar Mar 26 '25 06:03 kingzcheung

I was able to temporarily get around this by specifying the version like:

[patch.crates-io]
sfv = { git = "https://github.com/undef1nd/sfv.git", tag = "v0.9.4" }

SherClockHolmes avatar Mar 26 '25 16:03 SherClockHolmes

I locked the sfv version 0.10

sfv = "^0.10"

mingjunyang avatar Mar 28 '25 09:03 mingjunyang

I'm facing the same issue, though oddly I've not had much luck even pinning to older versions of sfv. I get the same error with sfv 0.9.4 and 0.10.4. Though interestingly I get the same error even attempting to use pingora 0.3.

edit1: Well, I'm a dummy. Didn't actually allow the Cargo.lock to be rebuilt after I applied this. Workaround is working now.

avirtuos avatar Apr 01 '25 17:04 avirtuos

Is there any plan to release this bug fix anytime soon?

SantiagoPittella avatar Apr 14 '25 16:04 SantiagoPittella