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
Unknown Object (File)
Thu, Apr 25, 1:37 AM
Unknown Object (File)
Thu, Apr 11, 9:18 AM
Unknown Object (File)
Mon, Apr 8, 4:52 AM
Unknown Object (File)
Wed, Mar 27, 8:33 PM
Unknown Object (File)
Mar 15 2024, 9:21 PM
Unknown Object (File)
Mar 5 2024, 8:35 AM
Unknown Object (File)
Feb 11 2024, 9:49 PM
Unknown Object (File)
Jan 18 2024, 5:59 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.