Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16420

Re: Backspace echoed incorrectly with TERM=garbage

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Backspace echoed incorrectly with TERM=garbage
Date 2020-06-20 14:25 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.170.1592677542.2574.bug-bash@gnu.org> (permalink)
References (4 earlier) <13540.bryanh@giraffe-data.com> <CANaoh6J1ttm_Mqm1m7Equ4k02LYLLZ=Ao3A8L30mM=77h_ysOA@mail.gmail.com> <69359.bryanh@giraffe-data.com> <18314.bryanh@giraffe-data.com> <3ee025ae-e293-0e88-c6fe-1e1713ce34a7@case.edu>

Show all headers | View raw


On 6/19/20 7:53 PM, Bryan Henderson wrote:
> I tracked it down to an Ncurses change.
> 
> Bash/readline attempts to move the cursor left by calling Ncurses (libtinfo)
> function 'tputs' with ASCII BS (ctl-H) as the argument.  The function of
> 'tputs' is to write stuff to the terminal with delays added, as required by
> early printing terminals.
> 
> In the past, if TERM were set to something undefined, tputs would go ahead and
> write the BS to the terminal, but in the libtinfo linked to Bash on my Debian
> 10 system, tputs fails (returns failure code without writing anything to the
> terminal) if TERM is set to something undefined.  (It still works if TERM
> isn't defined at all, though).  Bash ignores the failure and continues,
> writing a space to the terminal, followed by another failing call to 'tputs'
> for the final backspace.

This is consistent with what I discovered, which is that tputs does not
call the character output function passed as the third argument at all.

I don't know why the ncurses maintainers changed this in version 6, though
I suspect they had some rationale for it at the time. It looks like a
departure from historical versions of curses/ncurses.

The historical behavior (what readline expects) of tputs is to set the
amount of padding required to 0 if the terminal type is unknown, which
basically makes it an indirect per-character function call. From what I've
seen, it fails only if the string parameter is NULL.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Backspace echoed incorrectly with TERM=garbage Chet Ramey <chet.ramey@case.edu> - 2020-06-20 14:25 -0400

csiph-web