From owner-freebsd-hackers@freebsd.org Wed May 24 08:55:22 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47901D7B096 for ; Wed, 24 May 2017 08:55:22 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 25D6A18C7 for ; Wed, 24 May 2017 08:55:22 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 252F6D7B094; Wed, 24 May 2017 08:55:22 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24D30D7B093 for ; Wed, 24 May 2017 08:55:22 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF76B18C6 for ; Wed, 24 May 2017 08:55:21 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm0-x234.google.com with SMTP id d127so59332105wmf.0 for ; Wed, 24 May 2017 01:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=H6u9MvIrBfQ9Aou3fqTNM0evYE5ija6UqOoCWDJLwRk=; b=SkLo0H5Axc/wWeeAEAGoMyNR8j8ZpvR3BzrFAwYMis39PZ68g6KvUMpHuvWXANCC8B yfcjBNOZ0iFH/+iKxzcd/t5nc4hSE2P4VeINzNwzeALRzal/A1zdmJAnUhJ6egK6U9xB 8voa0ybT8XxgsxOZzaCrzuOd73T6VPq5U5rbARXIIiTHRuRYsH3VsZ2jOLuP8S1bTkEK 7Ptc7enIJ8WuqduuRFWt1fB9l6q1Nkl8ZK/hKzKu7HQEyFnfyi2CpsEXN1o/kvrUu9r8 2DeKqX+RX9qCvTDh4TBw8GhqUtIhm2GL/OMjdivqHbzf/fp4+uAnqJX820JyYw0K0DqI bWdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition:user-agent; bh=H6u9MvIrBfQ9Aou3fqTNM0evYE5ija6UqOoCWDJLwRk=; b=fM3+2voLqTL/jSs4s9PEZmxv/RN+S+Lst5hSDW1Qd/lmDyeIftcOu329/RJSrlNkZz SjmveU41BcI58MOLL0Kuvw006Pv8tqyKt93pxn2GisInWDcjSUUH1Z9w7UAwqfUeStUl fFQ46K8RpGGhPx7suH0gJicKq1ewYXZTAwaDzhsW1QFVt9Vav1ADEJba9s+88TFeBKxs FQ5t6PY8JBJ7Vzi8nRdHPQSco52L/gOoasa3mzzz6dHcTVnqIa8sPLuDKaZ3kbNdr8yP Q+yjT/QP7SiKyYnN06BbijrEZ9WhRozxx6rvYv+kVcb5zqTQFF25jeeE3tW80gpxo4Zl cETw== X-Gm-Message-State: AODbwcChovSEuVPblOt8HUq/9134wxyaMB2ujgjAsRJgME0EIcipIph9 IIxvJ0ySHQFhdytl X-Received: by 10.223.168.97 with SMTP id l88mr18963862wrc.54.1495616117983; Wed, 24 May 2017 01:55:17 -0700 (PDT) Received: from brick (cpc92310-cmbg19-2-0-cust934.5-4.cable.virginm.net. [82.9.227.167]) by smtp.gmail.com with ESMTPSA id e187sm4868791wmf.31.2017.05.24.01.55.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 May 2017 01:55:16 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 24 May 2017 09:55:14 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: hackers@FreeBSD.org Subject: Serial line terminal size. Message-ID: <20170524085514.GA4210@brick> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.8.2 (2017-04-18) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 May 2017 08:55:22 -0000 There's a problem with serial consoles - after logging in, the terminal size is not set, ie it looks like this (notice the "0 rows; 0 columns;"): speed 9600 baud; 0 rows; 0 columns; lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl -echoprt -altwerase -noflsh -tostop -flusho -pendin -nokerninfo -extproc iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk brkint -inpck -ignpar -parmrk oflags: opost onlcr -ocrnl tab0 -onocr -onlret cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow -dtrflow -mdmbuf cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ; eol2 = ; erase = ^?; erase2 = ^H; intr = ^C; kill = ^U; lnext = ^V; min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T; stop = ^S; susp = ^Z; time = 0; werase = ^W; This makes some things - like vi(1) or tcsh(1) - handle the screen in a rather strange, and quite broken, way. I'd like to make this work correctly by default by applying the patch below. It should be completely non-intrusive (the -z flag makes resizewin(1) not do anything if the terminal size is not zero, and it's not zero for network protocols and vt(4)), but since this involves running things by default, including for root - I thought I'd better ask. Thanks! https://reviews.freebsd.org/D10642 Index: etc/root/dot.login =================================================================== --- etc/root/dot.login +++ etc/root/dot.login @@ -5,5 +5,8 @@ # see also csh(1), environ(7). # +# Query terminal size; useful for serial lines. +if ( -x /usr/bin/resizewin ) /usr/bin/resizewin -z + # Uncomment to display a random cookie each login: # if ( -x /usr/bin/fortune ) /usr/bin/fortune -s Index: etc/root/dot.profile =================================================================== --- etc/root/dot.profile +++ etc/root/dot.profile @@ -8,3 +8,5 @@ export TERM PAGER=more export PAGER + +if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi Index: share/skel/dot.login =================================================================== --- share/skel/dot.login +++ share/skel/dot.login @@ -5,4 +5,5 @@ # see also csh(1), environ(7). # +if ( -x /usr/bin/resizewin ) /usr/bin/resizewin -z if ( -x /usr/bin/fortune ) /usr/bin/fortune freebsd-tips Index: share/skel/dot.profile =================================================================== --- share/skel/dot.profile +++ share/skel/dot.profile @@ -21,4 +21,7 @@ # set ENV to a file invoked each time sh is started for interactive use. ENV=$HOME/.shrc; export ENV +# Query terminal size; useful for serial lines. +if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi + if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi