#build #uuid #buildid

sys build_id

Obtain a UUID uniquely representing the build of the current binary

8 releases

0.2.1 Nov 24, 2019
0.2.0 Oct 18, 2019
0.1.5 Aug 1, 2019
0.1.4 Jul 26, 2019
0.1.1 Jul 26, 2018

#340 in Development tools

Download history 88/week @ 2021-01-12 152/week @ 2021-01-19 87/week @ 2021-01-26 102/week @ 2021-02-02 113/week @ 2021-02-09 158/week @ 2021-02-16 94/week @ 2021-02-23 121/week @ 2021-03-02 118/week @ 2021-03-09 93/week @ 2021-03-16 86/week @ 2021-03-23 73/week @ 2021-03-30 82/week @ 2021-04-06 136/week @ 2021-04-13 84/week @ 2021-04-20 110/week @ 2021-04-27

494 downloads per month
Used in 9 crates (via relative)

MIT/Apache

10KB
106 lines

build_id

Crates.io MIT / Apache 2.0 licensed Build Status

Docs

Obtain a Uuid uniquely representing the build of the current binary.

This is intended to be used to check that different processes are indeed invocations of identically laid out binaries.

As such:

  • It is guaranteed to be identical within multiple invocations of the same binary.
  • It is guaranteed to be different across binaries with different code or data segments or layout.
  • Equality is unspecified if the binaries have identical code and data segments and layout but differ immaterially (e.g. if a timestamp is included in the binary at compile time).

Examples

let local_build_id = build_id::get();
if local_build_id == remote_build_id {
	println!("We're running the same binary as remote!");
} else {
	println!("We're running a different binary to remote");
}

Note

This looks first for linker-inserted build ID / binary UUIDs (i.e. .note.gnu.build-id on Linux; LC_UUID in Mach-O; etc), falling back to hashing the whole binary.

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.4–0.9MB
~16K SLoC