Page MenuHomeFreeBSD

vis.3: Try to better describe VIS_SAFE
ClosedPublic

Authored by des on Apr 29 2026, 6:48 PM.
Tags
None
Referenced Files
F162722530: D56716.id177150.diff
Thu, Jul 16, 4:06 AM
Unknown Object (File)
Wed, Jul 15, 5:44 AM
Unknown Object (File)
Wed, Jul 15, 5:44 AM
Unknown Object (File)
Wed, Jul 8, 8:02 PM
Unknown Object (File)
Tue, Jul 7, 10:43 PM
Unknown Object (File)
Tue, Jul 7, 8:00 AM
Unknown Object (File)
Mon, Jul 6, 9:54 PM
Unknown Object (File)
Mon, Jul 6, 9:21 PM
Subscribers

Details

Summary

The current text is correct, but fails to draw the reader's attention
to the fact that VIS_SAFE essentially works in reverse, i.e. it exempts
certain characters from being encoded.

While here, fix some markup nits.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Apr 29 2026, 6:48 PM

@adrian could you perhaps look into getting this reviewed and committed upstream?

contrib/libc-vis/vis.3
297

Now I'm back to not understanding this flag. This text, and the old one, makes it sound like VIS_SAFE overrides other flags. But it doesn't:

$ hexdump -C space
00000000  20 0a                                             | .|
00000002
$ vis -s space

$ vis -w -s space
\040\012$

And looking at the implementation, it seems that VIS_SAFE just means "don't encode backspace, bell, and carriage return." Those characters are encoded by default.

302

It has no effect on space, tab, or newline.

contrib/libc-vis/vis.3
301

Graphic characters are not affected by this flag either.

This revision is now accepted and ready to land.May 3 2026, 11:39 PM
This revision was automatically updated to reflect the committed changes.