Page MenuHomePhabricator

Introduce tsprintf(), for escaping terminal output
ClosedPublic

Authored by epriestley on May 21 2015, 3:23 PM.
Tags
None
Referenced Files
F14076294: D12966.diff
Thu, Nov 21, 4:43 PM
Unknown Object (File)
Mon, Nov 18, 3:31 PM
Unknown Object (File)
Mon, Nov 18, 4:17 AM
Unknown Object (File)
Thu, Nov 14, 7:30 AM
Unknown Object (File)
Thu, Nov 14, 12:34 AM
Unknown Object (File)
Wed, Nov 13, 2:08 PM
Unknown Object (File)
Sat, Nov 9, 9:25 PM
Unknown Object (File)
Thu, Nov 7, 11:28 PM

Details

Summary

Ref T8243. User-controlled strings like task and revision titles may contain terminal control codes which can make text bold and colorful when they shouldn't be at a minimum, and possibly do some worse things in some terminals.

Add tsprintf() for escaping these sorts of strings in order to show them to human viewers.

Test Plan

Added and executed unit tests.

Diff Detail

Repository
rPHU libphutil
Branch
tsprintf
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 6186
Build 6207: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

epriestley retitled this revision from to Introduce tsprintf(), for escaping terminal output.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.May 21 2015, 4:32 PM

Hey tsprintf - welcome buddy.

We also have phutil_console_format, which seems somewhat similar.

We also have phutil_console_format, which seems somewhat similar.

Or rather, the distinction between the two is a little unclear.

This revision was automatically updated to reflect the committed changes.