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
F167456772: D56716.id176822.diff
Fri, Aug 21, 9:33 PM
Unknown Object (File)
Sat, Aug 15, 7:03 AM
Unknown Object (File)
Sat, Aug 15, 4:19 AM
Unknown Object (File)
Fri, Aug 14, 5:22 PM
Unknown Object (File)
Tue, Aug 11, 10:58 PM
Unknown Object (File)
Mon, Aug 10, 2:46 PM
Unknown Object (File)
Sun, Aug 9, 4:52 AM
Unknown Object (File)
Sun, Aug 9, 4:20 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.