All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>, util-linux@vger.kernel.org
Subject: Re: [PATCH v2] agetty: don't put the VC into canonical mode
Date: Fri, 19 Oct 2018 09:53:03 +0200	[thread overview]
Message-ID: <20181019075303.d6bqf3yja6psshqu@ws.net.home> (raw)
In-Reply-To: <9313c880-265c-908a-6138-c8f24d6c434e@suse.cz>

On Thu, Oct 18, 2018 at 09:25:33PM +0200, Stanislav Brabec wrote:
> On Oct 16, 2018 at 9:40 AM Karel Zak wrote:
> > On Tue, Oct 16, 2018 at 08:41:49AM +0200, Lubomir Rintel wrote:
> >> Seems like zero lflags do the job just fine on a Linux VT. Reset it to
> >> canonical mode before running login.
> > 
> > What about Del/Backspace keys when user is typing login name? :-)
> 
> It could be easy without Backspace support. Just read the characters.
> But we have to implement Backspace.
> 
> When you leave canonical mode, then agetty code has to handle Backspace.
> 
> Hopefully, agetty doesn't support arrows and Delete (forward delete),
> so we don't have to implement advanced parts of line editing.
> 
> My experiments show two possibilities. I am not sure, what is better,
> but 1 seems to be more straightforward.
> 
> 
> 1) c_lflag &= ~(ICANON | ECHO)
> 
> This falls back to a no echo mode. Program has to handle echo and
> buffer parsing. Program has to handle backspace.
> 
> The implementation seems to be straightforward.
> 
> Downside: Remote logins can experience delays when getting echo.

This seems like a small downside as data from remote machine is pretty
common thing for remote access :-)

> 2) c_lflag &= ~(ICANON)
> 
> Non-canonical mode with echo seems to be usable as well. The terminal
> itself does the echo, program does the input parsing. Program has to
> handle Backspace. Echo will be immediate even with slow remote logins,
> but Backspace has to be handled remotely.
> 
> The second implementation has a problem: The Linux console input and
> output are out of sync in the time of agetty. Input returns 0x7f after
> pressing backspace, but output does back step (not back space) after
> sending 0x08. I don't know the fix yet.

This seems fragile, especially on environment with obscure serial
lines (or serial over ssh, etc.) where nobody has clue about proper
setting. It seems better to be slow than fragile.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2018-10-19  7:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16  6:41 [PATCH v2] agetty: don't put the VC into canonical mode Lubomir Rintel
2018-10-16  7:40 ` Karel Zak
2018-10-18 19:25   ` Stanislav Brabec
2018-10-19  7:53     ` Karel Zak [this message]
2018-10-19  6:09   ` Lubomir Rintel
2018-10-19 13:08     ` Stanislav Brabec
2018-10-19 13:48       ` Lubomir Rintel
2018-10-19 20:08         ` Stanislav Brabec
2018-10-22  9:23           ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181019075303.d6bqf3yja6psshqu@ws.net.home \
    --to=kzak@redhat.com \
    --cc=lkundrak@v3.sk \
    --cc=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.