Page MenuHomePhabricator

Improve "--trace" behavior when output includes binary queries
ClosedPublic

Authored by epriestley on Aug 3 2018, 9:49 PM.
Tags
None
Referenced Files
F13984547: D19564.id.diff
Sun, Oct 20, 2:06 PM
Unknown Object (File)
Oct 13 2024, 9:03 PM
Unknown Object (File)
Oct 9 2024, 9:48 AM
Unknown Object (File)
Sep 22 2024, 6:43 PM
Unknown Object (File)
Sep 15 2024, 1:39 PM
Unknown Object (File)
Sep 9 2024, 2:10 PM
Unknown Object (File)
Sep 9 2024, 2:36 AM
Unknown Object (File)
Sep 6 2024, 3:40 AM
Subscribers
None

Details

Summary

Ref T13164. See PHI766. If you bin/harbormaster rebuild-log ... --force --trace, you can get a trace with a bunch of binary gzip data in it.

This tends to make your terminal beep a lot and sometimes turn into funny colors or symbols.

Instead, replace runs of binary data with the text "<...binary data...>". Also, collapse multiple consecutive whitespace characters into a single whitespace character.

Broadly, both changes make these traces easier to read.

Test Plan

Ran bin/harbormaster rebuild-log ... --force --trace on a 20MB log of reasonably normal data, no longer got beeped at fifty times.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

amckinley added inline comments.
src/serviceprofiler/PhutilServiceProfiler.php
205

So this is.... a single character with byte values 0-31 or 127-255, followed by any number of groups consisting of 0-12 bytes of whatever, followed by another single character with byte values 0-31 or 127-255? That seems reasonable; I just want to be sure I'm parsing it correctly.

Do we need a /u at the end for matching unicode?

This revision is now accepted and ready to land.Aug 3 2018, 10:53 PM

Yep -- or that's what I tried to write, at least. Although note the final *, so this also matches a single byte in 0-31,127-255 with nothing else.

I believe we only need /u when we want certain somewhat-unusual stuff to work like having \s or \B match particular multilingual space/boundary characters or make . match multi-byte characters as a single thing.

This revision was automatically updated to reflect the committed changes.