8000 Avoid printing binary graffiti to logs · Issue #1566 · sigp/lighthouse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Avoid printing binary graffiti to logs #1566
Closed
@michaelsproul

Description

@michaelsproul

Description

We seem to output block graffiti to the logs without escaping or removing unprintable characters, which causes text-based tools like grep to choke up:

$ grep 'graffiti' medalla_bn.log
Binary file medalla_bn.log matches

(You need to re-run with grep --text)

It looks like we make some attempt to sanitize the graffiti, but it doesn't seem to be working as intended. An alternative approach might involve stripping \0 from the end of the string, and processing the rest with String::from_utf8_lossy

let graffiti_string = String::from_utf8(block.message.body.graffiti[..].to_vec())
.unwrap_or_else(|_| format!("{:?}", &block.message.body.graffiti[..]));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0