bugGNU Screen - Bugs: bug #48339, Default settings of termios...

 
 

bug #48339: Default settings of termios parameters (VKILL, etc.) are ugly

Submitter:  Valentin Nechayev <netch>
Submitted:  Wed 29 Jun 2016 09:06:13 AM UTC
   
 
Category:  Program Logic Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  Cur Dev Sources
Fixed Release:  4.5.0 Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 04 Jul 2016 06:34:33 PM UTC, comment #2: 

Nice find, thanks. Hopefully fixes weird issues that people were experiencing sometimes while starting detached sessions.

Pushed changes to screen-v4 & master.

Amadeusz Sławiński <amade>
Group administrator
Wed 29 Jun 2016 01:34:38 PM UTC, comment #1: 

Minor fixup: s/_POSIX_VDISABLE/VDISABLE/
the latter is already present in os.h and used in neighbor places.

Valentin Nechayev <netch>
Wed 29 Jun 2016 09:06:13 AM UTC, original submission:  

There are three issues in the same code chunk so I prefer to note them together.

I. InitTTY() in tty.c currently has (in master branch):

#if defined(VKILL)
#if (VKILL < MAXCC)
        m->tio.c_cc[VKILL] = Ctrl('H');
#endif

All other settings look reasonable but Ctrl+H for VKILL is strongly weird because the default for the thorough Unix life is Ctrl+U.

This value is copied from pre-Git times, reasoning isn't known, so I suggest this is typo going from times of battle between two Backspace styles.

This affects terminals created in initially detached mode, with command like "screen -c $config -dm" and config lines like

screen -t proxy 0
stuff "~/utils/gasket proxy\n"

the created terminal is badly controllable.

Fix is trivial:

diff --git a/src/tty.c b/src/tty.c
index 585e0f50..d50486f7 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -272,7 +272,7 @@ void InitTTY(struct mode *m, int ttyflag)
 #endif                         /* VERASE */
 #if defined(VKILL)
 #if (VKILL < MAXCC)
-       m->tio.c_cc[VKILL] = Ctrl('H');
+       m->tio.c_cc[VKILL] = Ctrl('U');
 #endif
 #endif                         /* VKILL */
 #if defined(VEOF)

II. Also, such terminals get VMIN=0, despite tty.c code sets TTYVMIN to 1 and then sets VMIN to TTYVMIN.

III. For some parameters, it sets values to 0 in context where they supposed to be disabled:

#if defined(VEOL)
#if (VEOL < MAXCC)
        m->tio.c_cc[VEOL] = 0000;
#endif

the same for VEOL2, VSWTCH. But, 0 is "disable" at Linux and some other flavors, but not BSD group.

Suggested fix:

diff --git a/src/tty.c b/src/tty.c
index 585e0f50..48af30a6 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -47,6 +47,10 @@
 #include "telnet.h"
 #include "tty.h"
 
+#ifndef _POSIX_VDISABLE
+#define _POSIX_VDISABLE 0000
+#endif
+
 static void consredir_readev_fn(Event , void );
 
 bool separate_sids = true;
@@ -282,17 +286,17 @@ void InitTTY(struct mode *m, int ttyflag)
 #endif                         /* VEOF */
 #if defined(VEOL)
 #if (VEOL < MAXCC)
-       m->tio.c_cc[VEOL] = 0000;
+       m->tio.c_cc[VEOL] = _POSIX_VDISABLE;
 #endif
 #endif                         /* VEOL */
 #if defined(VEOL2)
 #if (VEOL2 < MAXCC)
-       m->tio.c_cc[VEOL2] = 0000;
+       m->tio.c_cc[VEOL2] = _POSIX_VDISABLE;
 #endif
 #endif                         /* VEOL2 */
 #if defined(VSWTCH)
 #if (VSWTCH < MAXCC)
-       m->tio.c_cc[VSWTCH] = 0000;
+       m->tio.c_cc[VSWTCH] = _POSIX_VDISABLE;
 #endif
 #endif                         /* VSWTCH */
 #if defined(VSTART)

Valentin Nechayev <netch>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amade (Posted a comment)
  • -email is unavailable- added by netch (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-18 amade Open/ClosedOpen Closed
        Fixed ReleaseNone 4.5.0
    2016-07-04 amade StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code