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
Unknown Object (File)
Wed, Jun 17, 10:02 PM
Unknown Object (File)
Sun, Jun 7, 6:25 PM
Unknown Object (File)
Mon, Jun 1, 10:21 PM
Unknown Object (File)
Mon, Jun 1, 10:17 PM
Unknown Object (File)
Mon, Jun 1, 5:00 PM
Unknown Object (File)
Mon, Jun 1, 5:00 PM
Unknown Object (File)
Sun, May 31, 7:25 AM
Unknown Object (File)
Sun, May 31, 7:22 AM
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.