[−][src]Macro releasetag::releasetag
Placing a formatted byte-string on process-stack eventually propagating into crash core-dumps.
This macro takes a number of comma-separated byte string literals, byte-arrays or content of includes forming a single byte-sequence on stack with leading and trailing zero-bytes, terminating the strings.
These arrays and included files must not cotain and zero-string. The code would compile, and the data would reside in core files, but tools like 'strings' would extract not a single string but multiple strings.
That said: if you do not depend on tools like 'strings' extracting zero-terminated strings from binaries, your tag and files may be formed by any kind of byte-sequence.
Example
#[macro_use(releasetag)] extern crate releasetag; fn main() { releasetag!(b"BUILD_TAG=pre"); releasetag!(b"BUILD_TAG=", b"MAIN_2016-wk16-05-AAAA-BBBB-CCCC-DDDD-EEEE-FFFF-GGGG-HHHH-IIII-JJJJ-KKKK"); // Including data from one or multiple files or compile time env params. // Note: the content mustn't contain any newline or linebreak as those would interfer with zero terminated strings!! let mut version: [u8; 5] = [0; 5]; version.copy_from_slice(env!("CARGO_PKG_VERSION").as_bytes()); releasetag!(b"BUILD_VERSION=", &version); releasetag!(b"BUILD_TAG=", &version, b"/", include_bytes!("../AUTHOR")); // or as byte array releasetag!(b"BUILD_HOST=", &[0x30u8, 0x31u8, 0x33u8]); // your application logic here }