Bug 220507

Summary: resizewin(1) doesn't work with vt(4)
Product: Base System Reporter: Edward Tomasz Napierala <trasz>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: cem, ed, emaste, trasz
Priority: --- Keywords: vt
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Edward Tomasz Napierala freebsd_committer 2017-07-06 11:02:19 UTC
Running resizewin(1) utility in vt(4) results in a "resizewin: timeout reading from terminal" error.  Apparently it never gets the response.
Comment 1 Edward Tomasz Napierala freebsd_committer 2017-07-07 07:55:09 UTC
FWIW, it also doesn't work with XTerm's resize(1).  The cursor is visibly moved to the bottom left corner.  Perhaps vt(4) fails to implement the escape code that retrieves cursor position?
Comment 2 Ed Maste freebsd_committer 2019-09-20 08:39:56 UTC
See sys/teken/libteken/teken.3:
>     The tf_respond() callback is used to respond to device status requests
>     commands generated by an application.  In the past, there have been
>     various security issues, where a malicious application sends a device
>     status request before termination, causing the generated response to be
>     interpreted by applications such as sh(1).
>     teken only implements a small subset of responses which are unlikely to
>     cause any harm.  Still, it is advised to leave tf_respond()
>     unimplemented.

and indeed vt(4) does not set tf_respond.

For reference syscons provides scteken_respond; see sys/dev/syscons/scterm-teken.c and sc_respond in sys/dev/syscons/syscons.c
Comment 3 Conrad Meyer freebsd_committer 2019-09-20 14:07:34 UTC
For what it's worth, I mostly use resizewin with resizable terms under a GUI environment.

At work, though, I use it with (I guess) sc over serial.  So if vt were just to implement the "small subset of responses which are unlikely to cause any harm," or even just the set needed by resizewin, I would appreciate it.
Comment 4 Ed Maste freebsd_committer 2019-09-24 18:31:38 UTC
(In reply to Conrad Meyer from comment #3)
vt and sc are used only for the video (e.g., VGA or UEFI framebuffer) console; serial doesn't use either. teken is the terminal emulator which interprets escape codes and it already implements the "small subset of responses."

Presumably all that needs to be done to address this PR is to add a vt tf_respond.