Skip to content

Commit 3d4e696

Browse files
kbsteereYangKeao
andauthored
Protobuf 3.7.2 bump and updated build.rs to fix GHSA-2gh3-rmm4-6rq5, linter allows added. (#264)
* updated protobuf version to be a minimum of 3.7.2 to address GHSA-2gh3-rmm4-6rq5. Added linter allows so build and tests pass Signed-off-by: Kyle Steere <[email protected]> * removed protobuf-codegen-pure, protobuf 3.7.2 removed package Signed-off-by: Kyle Steere <[email protected]> * updated build.rs to use protobuf_codegen instead of protobuf_codegen_pure Signed-off-by: Kyle Steere <[email protected]> * added .pure implementation removed commented lines from previous commit commented out profile.encode due to testing failures Signed-off-by: Kyle Steere <[email protected]> * updated README, rust.yml and Cargo.toml to rust 1.71.0 Signed-off-by: Kyle Steere <[email protected]> * added #allow's for cargo clippy warnings Signed-off-by: Kyle Steere <[email protected]> * updating toolchain for .github/workflows Signed-off-by: Kyle Steere <[email protected]> * upgrade MSRV to 1.74.0 Signed-off-by: Yang Keao <[email protected]> * remove clippy annotations as much as possible Signed-off-by: Yang Keao <[email protected]> --------- Signed-off-by: Kyle Steere <[email protected]> Signed-off-by: Yang Keao <[email protected]> Co-authored-by: Yang Keao <[email protected]>
1 parent bc23fa1 commit 3d4e696

File tree

7 files changed

+80
-35
lines changed

7 files changed

+80
-35
lines changed

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions-rs/[email protected]
2020
with:
2121
profile: minimal
22-
toolchain: 1.66.0
22+
toolchain: 1.74.0
2323
override: true
2424
components: rustfmt, clippy
2525

@@ -56,7 +56,7 @@ jobs:
5656
strategy:
5757
matrix:
5858
os: [ubuntu-latest, macos-latest]
59-
toolchain: [stable, nightly, 1.66.0]
59+
toolchain: [stable, nightly, 1.74.0]
6060
target:
6161
[
6262
x86_64-unknown-linux-gnu,

Cargo.lock

Lines changed: 57 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "An internal perf tools for rust programs."
88
repository = "https://github.com/tikv/pprof-rs"
99
documentation = "https://docs.rs/pprof/"
1010
readme = "README.md"
11-
rust-version = "1.66.0" # MSRV
11+
rust-version = "1.74.0" # MSRV
1212

1313
[features]
1414
default = ["cpp"]
@@ -19,7 +19,7 @@ frame-pointer = []
1919
# A private feature to indicate either prost-codec or protobuf-codec is enabled.
2020
_protobuf = []
2121
prost-codec = ["prost", "prost-derive", "prost-build", "sha2", "_protobuf"]
22-
protobuf-codec = ["protobuf", "protobuf-codegen-pure", "_protobuf"]
22+
protobuf-codec = ["protobuf", "protobuf-codegen", "_protobuf"]
2323

2424
[dependencies]
2525
backtrace = { version = "0.3" }
@@ -37,7 +37,7 @@ smallvec = "1.7"
3737
inferno = { version = "0.11", default-features = false, features = ["nameattr"], optional = true }
3838
prost = { version = "0.12", optional = true }
3939
prost-derive = { version = "0.12", optional = true }
40-
protobuf = { version = "2.0", optional = true }
40+
protobuf = { version = ">=3.7.2", optional = true }
4141
criterion = {version = "0.5", optional = true}
4242
aligned-vec = "0.6"
4343

@@ -53,7 +53,7 @@ rand = "0.8.0"
5353
[build-dependencies]
5454
prost-build = { version = "0.12", optional = true }
5555
sha2 = { version = "0.10", optional = true }
56-
protobuf-codegen-pure = { version = "2.0", optional = true }
56+
protobuf-codegen = { version = "3.7.2", optional = true }
5757

5858
[[example]]
5959
name = "flamegraph"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Unit tests have been added to guarantee there is no `malloc` in sample functions
247247

248248
## Minimum Supported Rust Version
249249

250-
Rust 1.64 or higher.
250+
Rust 1.74 or higher.
251251

252252
Minimum supported Rust version can be changed in the future, but it will be done with a minor version bump.
253253

build.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.
2-
32
#[cfg(feature = "protobuf-codec")]
43
// Allow deprecated as TiKV pin versions to a outdated one.
5-
#[allow(deprecated)]
64
fn generate_protobuf() {
75
use std::io::Write;
8-
6+
let customize = <protobuf_codegen::Customize as std::default::Default>::default();
7+
// Set the output directory for generated files
98
let out_dir = std::env::var("OUT_DIR").unwrap();
10-
protobuf_codegen_pure::run(protobuf_codegen_pure::Args {
11-
out_dir: &out_dir,
12-
includes: &["proto"],
13-
input: &["proto/profile.proto"],
14-
customize: protobuf_codegen_pure::Customize {
15-
generate_accessors: Some(false),
16-
lite_runtime: Some(true),
17-
..Default::default()
18-
},
19-
})
20-
.unwrap();
9+
10+
let mut cg = protobuf_codegen::Codegen::new();
11+
cg.pure();
12+
13+
cg.inputs(["proto/profile.proto"]).includes(["proto"]);
14+
15+
cg.customize(customize);
16+
cg.out_dir(&out_dir).run().unwrap();
17+
18+
// Optionally, write a mod.rs file for module inclusion
2119
let mut f = std::fs::File::create(format!("{}/mod.rs", out_dir)).unwrap();
2220
write!(f, "pub mod profile;").unwrap();
2321
}

src/backtrace/backtrace_rs.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,3 @@ impl super::Trace for Trace {
2323
unsafe { backtrace::trace_unsynchronized(cb) }
2424
}
2525
}
26-
27-
pub use backtrace::Frame;
28-
pub use backtrace::Symbol;

src/backtrace/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ pub trait Frame: Sized + Clone {
3232
type S: Symbol;
3333

3434
fn resolve_symbol<F: FnMut(&Self::S)>(&self, cb: F);
35+
36+
#[allow(dead_code)]
3537
fn symbol_address(&self) -> *mut c_void;
38+
39+
#[allow(dead_code)]
3640
fn ip(&self) -> usize;
3741
}
3842

0 commit comments

Comments
 (0)