LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-02-2017, 06:17 AM   #1
slalik
Member
 
Registered: Nov 2014
Location: Moscow, Russia
Distribution: Slackware
Posts: 165

Rep: Reputation: 118Reputation: 118
Backspace produces ^H after running slackrepo


Every time I run, for example
Code:
# slackrepo update
the Backspace key starts to produce ^H.

I use xterm.

The only workaround I know is to issue the command
Code:
# exec bash
Can somebody guess what is the problem?
 
Old 02-02-2017, 06:30 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 3,176

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
The ASCII backspace character 0x08 is ctrl-H. What is happening is that your shell is not interpreting it as the erase character. This can be set with the command stty.

Now, WHY it's happening is the question. Check that you are running the correct shell, that your local profile and .bashrc files are correct and that the settings in /etc/profile are correct.
 
1 members found this post helpful.
Old 02-02-2017, 06:43 AM   #3
slalik
Member
 
Registered: Nov 2014
Location: Moscow, Russia
Distribution: Slackware
Posts: 165

Original Poster
Rep: Reputation: 118Reputation: 118
Quote:
Originally Posted by smallpond View Post
The ASCII backspace character 0x08 is ctrl-H. What is happening is that your shell is not interpreting it as the erase character. This can be set with the command stty.
Thank you very much! I added 'stty erase ^H' to the end of /usr/sbin/slackrepo and now backspace works as it should!
Quote:
Originally Posted by smallpond View Post
Now, WHY it's happening is the question. Check that you are running the correct shell, that your local profile and .bashrc files are correct and that the settings in /etc/profile are correct.
Probably, slackrepo changes some settings. After I run slackrepo, 'stty -a' shows:
Code:
erase = ^?
 
Old 02-02-2017, 06:48 AM   #4
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 4,837

Rep: Reputation: Disabled
Quote:
Originally Posted by slalik View Post
Probably, slackrepo changes some settings. After I run slackrepo, 'stty -a' shows:
Code:
erase = ^?
if I just open a root bash login shell here and I run the same command I got
Code:
# stty -a
speed 38400 baud; rows 117; columns 407; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
so "erase = ^?" should be the default.

Last edited by ponce; 02-02-2017 at 06:56 AM.
 
Old 02-02-2017, 07:03 AM   #5
slalik
Member
 
Registered: Nov 2014
Location: Moscow, Russia
Distribution: Slackware
Posts: 165

Original Poster
Rep: Reputation: 118Reputation: 118
Quote:
Originally Posted by ponce View Post
if I just open a root bash login shell here and I run the same command I got
Code:
# stty -a
speed 38400 baud; rows 117; columns 407; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
so "erase = ^?" should be the default.
Did you run this command in console or xterm? My impression is that backspace produces ^? (ascii del) on console and ^H (ascii bs) on xterm.

Last edited by slalik; 02-02-2017 at 07:05 AM.
 
Old 02-02-2017, 07:15 AM   #6
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 4,837

Rep: Reputation: Disabled
that run in lxterminal, this is console
Code:
# stty -a
speed 38400 baud; rows 65; columns 210; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc
in xterm it's actually different
Code:
# stty -a
speed 38400 baud; rows 163; columns 632; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

Last edited by ponce; 02-02-2017 at 07:26 AM.
 
Old 02-02-2017, 07:25 AM   #7
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 4,837

Rep: Reputation: Disabled
at line 57 of slackrepo (got the git version here) "stty sane" is executed and that seems to confuse xterm.
from "man stty"
Code:
sane   same as cread -ignbrk brkint -inlcr -igncr icrnl icanon iexten echo echoe echok -echonl -noflsh-ixoff -iutf8
       -iuclc -ixany imaxbel -xcase -olcuc -ocrnl opost -ofill onlcr -onocr -onlret nl0 cr0 tab0 bs0 vt0 ff0 isig
 
1 members found this post helpful.
Old 02-02-2017, 08:16 AM   #8
slalik
Member
 
Registered: Nov 2014
Location: Moscow, Russia
Distribution: Slackware
Posts: 165

Original Poster
Rep: Reputation: 118Reputation: 118
Thank you ponce!

This problem (stty sane and xterm) was discussed on LFS mailing list. Their solution is to fix xterm settings ("Configuring xterm" section towards the bottom of the page) by adding
Code:
*backarrowKeyIsErase: true
*ptyInitialErase: true
to the X resources.

With these settings 'stty -a' yields 'erase = ^?' and Backspace and Del keys work as expected.

Looks like I'm to mark this thread SOLVED!
 
1 members found this post helpful.
Old 02-02-2017, 10:15 AM   #9
GazL
LQ Guru
 
Registered: May 2008
Posts: 5,035
Blog Entries: 16

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
Quote:
Originally Posted by slalik View Post
Thank you ponce!

This problem (stty sane and xterm) was discussed on LFS mailing list. Their solution is to fix xterm settings ("Configuring xterm" section towards the bottom of the page) by adding
Code:
*backarrowKeyIsErase: true
*ptyInitialErase: true
to the X resources.

With these settings 'stty -a' yields 'erase = ^?' and Backspace and Del keys work as expected.

Looks like I'm to mark this thread SOLVED!

Nope (well, maybe... but it depends). The problem with doing that is you're now at odds with the terminfo database entry for your terminal type which means you'll have problems with any curses programs that does something like:
Code:
/*  cc -lncurses <filename.c>  */

#include <stdlib.h>
#include <stdio.h>
#include <curses.h>

int main(void) {

    WINDOW * mainwin;

    mainwin = initscr();
    keypad(mainwin, TRUE);
    cbreak();
    noecho();

    addstr("Press backspace to exit!  ");
    refresh();

    while ( KEY_BACKSPACE != getch() ) {
      addstr("That's not backspace... ");
      refresh();
    }

    delwin(mainwin);
    endwin();
    refresh();

    return 0;
}
In practice this is such a common terminal misconfiguration that many programmers will actually treat either of ^H or ^? as backspace, but that might end up causing complications for a program on a terminal that actually does use ^H as backspace and ^? as DEL and which needs to differentiate between them. You don't generally encounter many of those these days, but it's still a consideration for those who care about such things.


I use ptyInitialErase: false to ensure that the terminal always matches it's terminfo data for this reason. That the linux pseudo ttys and consoles differ from xterm and default to ^? is annoying, but its not a problem with properly behaving programs. There's nothing wrong with terminals that use ^? as backspace and in many ways it helps (emacs ctrl-h for example), but the terminfo entry needs to reflect it.


IMO, the problem here is that slackrepo should not be issuing a 'stty sane' at all. If it must mess with tty settings while running then it should save them at the start before changing them and restore them to their original settings on exit , which is the polite thing to do. And stty sane isn't the correct way to do that.

Last edited by GazL; 02-02-2017 at 11:37 AM.
 
3 members found this post helpful.
Old 02-02-2017, 12:39 PM   #10
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 1,505

Rep: Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121Reputation: 1121
Quote:
Originally Posted by GazL View Post
IMO, the problem here is that slackrepo should not be issuing a 'stty sane' at all. If it must mess with tty settings while running then it should save them at the start before changing them and restore them to their original settings on exit , which is the polite thing to do. And stty sane isn't the correct way to do that.
That line has a comment that says this:

Code:
stty sane # in case we're killed waiting for the gpg passphrase
I can't say I really understand that. Maybe David could explain why it's needed?
 
Old 02-08-2017, 04:24 PM   #11
Xsane
Member
 
Registered: Jan 2014
Posts: 150

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by slalik View Post
Every time I run, for example
Code:
# slackrepo update
the Backspace key starts to produce ^H.
Default Slackware won't do that. You've changed something, /etc/termcap perhaps?

Quote:
Originally Posted by ponce View Post
in xterm it's actually different
Not on a default Slackware. It's ^? out of the box.

Quote:
Originally Posted by GazL View Post
The problem with doing that is you're now at odds with the terminfo database entry for your terminal type
Default Slackware's xterm is already at odds with terminfo.

Backspace:
termcap == ^?
stty erase == ^?
xterm == ^H

xterm sets 'stty erase' from /etc/termcap, but
then ignores it and uses ^H anyway.

Which means backspace should not work out of the box
and it doesn't outside of readline; in tzselect for example.
The only saving grace is that readline initially maps
both ^? and ^H to erase.

Here's the kicker, if 'stty erase' is changed it clobbers
the readline mapping.

So on a default Slackware in xterm+bash both backspace and
C-backspace will work (on xterm control toggles backspace
between ^H and ^?).

So initially 'stty erase' is ^?, but if you:
Code:
stty erase ^H
stty erase ^?
Now it is back to it's original value, but backspace will
not work due to readline's mappings being clobbered.

It's a crazy setup. The default /etc/termcap (which is a copy
of /etc/termcap-Linux) sets xterm's backspace to ^? (\177) and sets
linux console backspace to ^H. Exactly opposite of what you'd expect.

Quote:
Originally Posted by GazL View Post
That the linux pseudo ttys and consoles differ from xterm and default to ^?
In Slackware xterm defaults to ^? also.
 
3 members found this post helpful.
Old 02-08-2017, 05:10 PM   #12
GazL
LQ Guru
 
Registered: May 2008
Posts: 5,035
Blog Entries: 16

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
Quote:
Originally Posted by Xsane View Post
Default Slackware's xterm is already at odds with terminfo.

Backspace:
termcap == ^?
stty erase == ^?
xterm == ^H

xterm sets 'stty erase' from /etc/termcap, but
then ignores it and uses ^H anyway.
That's not my experience. Here is the output of stty and infocmp running just a window manager (No Desktop Environment funkyness) and with no .Xresources or .Xdefaults file and started using 'startx' so it should be as clean an environment as one can get.
Code:
stty -a
speed 38400 baud; rows 18; columns 135; line = 0;
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke -flusho -extproc

infocmp xterm
#	Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm
xterm|X11 terminal emulator,
	am, bce, km, mc5i, mir, msgr, npc, xenl,
	colors#8, cols#80, it#8, lines#24, pairs#64,
	acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
	bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
	clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
	csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
	cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
	cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
	cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
	dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
	flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
	ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
	ind=^J, indn=\E[%p1%dS, invis=\E[8m,
	is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
	kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
	kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H, kcbt=\E[Z,
	kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
	kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
	kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
	kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
	kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
	kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
	kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
	kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
	kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
	kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
	kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
	kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
	kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
	kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
	kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
	kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
	kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
	kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
	kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
	kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
	kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, op=\E[39;49m,
	rc=\E8, rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmacs=\E(B,
	rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>,
	rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec,
	rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm,
	setaf=\E[3%p1%dm,
	setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
	setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
	sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
	smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
	smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
	u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,
It does look like the xterm termcap definitions inherit kb= from vt-generic, and it is indeed \177 but terminfo clearly uses ^H as can be seen above so I'm assuming it's using the terminfo database and not the old-school /etc/termcap file.

I'm also using xterm -s /bin/ash so that readline doesn't interfere with the settings in any way, and everything is as one would expect from the terminfo definition and the backspace key generates ^H.

P.S. On my system, if I start xfce4-terminal, stty erase is ^? and backspace generates a ^? but the terminal sets TERM=xterm (which is a mismatch with terminfo) On xfce4-terminal my test ncurses program doesn't correctly identify backspace as backspace, instead it returns the 0x7F ^? character code, however, using xterm both KEY_BACKSPACE and KEY_DC are correctly identified by the ncurses routines because everything matches.

Last edited by GazL; 02-08-2017 at 06:09 PM.
 
Old 02-08-2017, 05:52 PM   #13
slalik
Member
 
Registered: Nov 2014
Location: Moscow, Russia
Distribution: Slackware
Posts: 165

Original Poster
Rep: Reputation: 118Reputation: 118
Quote:
Originally Posted by Xsane View Post
Default Slackware won't do that. You've changed something, /etc/termcap perhaps?
You are right, I use the termcap from the xterm source instead of termcap-Linux. The reason is that with termcap-Linux, when I sshed to a Slackware server from a Debian one, sometimes commands longer than one line rewrite on the same line making it impossible to use. Changing termcap resolved the problem.

Before starting this thread I tried to restore termcap, but did this on the server where I run slackrepo and not on the desktop from which I connect to the server, very stupid, sorry.
 
Old 02-08-2017, 06:02 PM   #14
GazL
LQ Guru
 
Registered: May 2008
Posts: 5,035
Blog Entries: 16

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
Interestingly, the /etc/termcap-BSD file sets kb=^H (xterm inherits from xterm-r6) unlike the termcap-linux one where xterm inherits from vt-generic, but again, I think most programs will be using terminfo rather than the termcap library anyway.
 
Old 02-09-2017, 02:48 PM   #15
Xsane
Member
 
Registered: Jan 2014
Posts: 150

Rep: Reputation: 112Reputation: 112
Quote:
Originally Posted by slalik View Post
The reason is that with termcap-Linux, when I sshed to a Slackware server from a Debian one, sometimes commands longer than one line rewrite on the same line making it impossible to use. Changing termcap resolved the problem.
Another mark against termcap-Linux.

I wasn't casting any blame on you slalik. I only pointed that out because if the
author of slackrepo is using a default setup they will not be able to duplicate
your issue.


Quote:
Originally Posted by GazL View Post
I'm assuming it's using the terminfo database and not the old-school /etc/termcap file.
Pat builds vanilla xterm and it will use termcap by default. As you can see:

Code:
~ $ ls -l /etc/termcap*
-rw-r--r-- 1 root root   8969 2017-02-06 16:20:01 /etc/termcap
-rw-r--r-- 1 root root 706385 2000-03-02 18:51:11 /etc/termcap-BSD
-rw-r--r-- 1 root root   8969 2004-02-15 23:04:55 /etc/termcap-Linux

~ $ PS1='$ ' TERMCAP='' xterm -s /bin/ash

$ stty -a | grep ' erase'      
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
$ 
$ 
$ echo $TERMCAP 
vs|xterm|xterm-color|vs100|xterm terminal emulator (X Window System):
am:bs:km:co#80:li#24:ct=\E[3k:ue=\E[m:is=\E[m\E[?1l\E>:rs=\E[m\E[?1l\E>:
eA=\E)0:as=^N:ae=^O:ac=aaffggjjkkllmmnnooqqssttuuvvwwxx:kI=\E[2~:
kD=:kP=\E[5~:kN=\E[6~:k1=\E[11~:k2=\E[12~:k3=\E[13~:
k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:F1=\E[23~:
F2=\E[24~:kh=\E[H:kH=\EOw:ks=:ke=:te=\E[2J\E[?47l\E8:
ti=\E7\E[?47h:ms:pt:xn:xo:it#8:RA=\E[?7l:SA=\E?7h:bl=^G:cr=^M:ta=^I:
cm=\E[%i%d;%dH:le=^H:up=\E[A:do=\E[B:nd=\E[C:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:
DO=\E[%dB:ho=\E[H:cl=\E[H\E[2J:ce=\E[K:cb=\E[1K:cd=\E[J:sf=\ED:sr=\EM:st=\EH:
cs=\E[%i%d;%dr:sc=\E7:rc=\E8:ic=\E[@:IC=\E[%d@:al=\E[L:AL=\E[%dL:dc=\E[P:DC=\E[%dP:
dl=\E[M:DL=\E[%dM:so=\E[7m:se=\E[m:us=\E[4m:mb=\E[5m:mh=\E[2m:md=\E[1m:mr=\E[7m:
me=\E[m:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:kb=\177:
$ 

# cp /etc/termcap-BSD /etc/termcap

~ $ ls -l /etc/termcap*
-rw-r--r-- 1 root root 706385 2017-02-09 14:01:57 /etc/termcap
-rw-r--r-- 1 root root 706385 2000-03-02 18:51:11 /etc/termcap-BSD
-rw-r--r-- 1 root root   8969 2004-02-15 23:04:55 /etc/termcap-Linux


~ $ PS1='$ ' TERMCAP='' xterm -s /bin/ash

$ stty -a | grep ' erase'
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = <undef>;
$ 
$ echo $TERMCAP
xterm|xterm terminal emulator (X Window System):
Km=\E[M:ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:u6=\E[%i%d;%dR:
u7=\E[6n:u8=\E[?1;2c:u9=\E[c:am:bs:km:mi:ms:xn:co#80:it#8:li#24:AL=\E[%dL:
DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:
al=\E[L:as=^N:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:
cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:im=\E[4h:
is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:
k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:
kI=\E[2~:kN=\E[6~:kP=\E[5~:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:
ku=\EOA:le=^H:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:sf=^J:
so=\E[7m:sr=\EM:ta=^I:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:up=\E[A:
us=\E[4m:kb=\010:
Note in the first 'echo $TERMCAP' that 'kD=' is empty, that's because it is
^? and doesn't print. If you pipe it to less you can see it. I've also chopped
up the output to make it easier to view here; otherwise it's one long line.
Also, this output is from 14.1, but I haven't seen Pat change anything that would
affect this.

I highlighted kD because termcap-Linux makes default Slackware's Delete key
invert the case on three characters /right/ of the cursor. As opposed to
erasing the character under the cursor as would be expected with VT-220 style
escape sequence ^[[3~.

Quote:
Originally Posted by GazL View Post
P.S. On my system, if I start xfce4-terminal, stty erase is ^? and backspace generates a ^? but the terminal sets TERM=xterm (which is a mismatch with terminfo) On xfce4-terminal my test ncurses program doesn't correctly identify backspace as backspace, instead it returns the 0x7F ^? character code, however, using xterm both KEY_BACKSPACE and KEY_DC are correctly identified by the ncurses routines because everything matches.
It looks like xfce4-terminal is picking up xterm| from /etc/termcap. That is what
xterm should be doing as well. It also looks like you are launching xterm from another
terminal; is $TERMCAP already set in its environment? xterm will inherit it if it is.

Last edited by Xsane; 02-09-2017 at 02:53 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: Initial Setup of slackrepo (plus some questions) bassmadrigal Slackware 98 09-17-2017 05:31 PM
slackrepo and custom SlackBuild atelszewski Slackware 4 11-01-2016 06:42 PM
[SOLVED] Two questions / wishes related to slackrepo slalik Slackware 3 07-21-2015 05:18 AM
[SOLVED] Running rc.local with additional routes produces SIOCADDRT file exists and bombs johnmchugh623 Debian 1 08-27-2010 07:38 AM
Backspace produces "^?" after upgrading to FC3 fearofcarpet Fedora 5 01-04-2005 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration