tcgetattr problem on solaris

From:

Dan Nicolaescu

Subject:

tcgetattr problem on solaris

Date:

Sat, 02 Oct 2004 13:25:01 -0700

Emacs was not doing the right thing with delete/backspace on a
sparc-sun-solaris2.8 machine. The problem seems to come from gcgetattr
that is not reading the correct definition for ERASE.
First let's look at the kbs terminfo entry for kbs:
:~...Emacs-CVS/objs/src> infocmp | grep kbs
kb2=\EOy, kbeg=\EOE, kbs=^?, kc1=\EOq, kc3=\EOs,
vino:~...Emacs-CVS/objs/src> gdb ./emacs
GNU gdb 6.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.7"...
DISPLAY = localhost:10.0
TERM = footerm
Breakpoint 1 at 0x136cac: file
/extra/dann0/local-build/Emacs-CVS/emacs/src/emacs.c, line 424.
Breakpoint 2 at 0x103264: file
/extra/dann0/local-build/Emacs-CVS/emacs/src/xterm.c, line 7811.
(gdb) b emacs_get_tty
Breakpoint 3 at 0x1667f4: file
/extra/dann0/local-build/Emacs-CVS/emacs/src/sysdep.c, line 1119.
(gdb) r -Q -nw
Starting program: /extra/dann0/local-build/Emacs-CVS/objs/src/emacs -Q -nw
Breakpoint 3, emacs_get_tty (fd=0, settings=0xffbeeee0)
at /extra/dann0/local-build/Emacs-CVS/emacs/src/sysdep.c:1119
1119 bzero (&settings->main, sizeof (settings->main));
(gdb) n
1120 if (tcgetattr (fd, &settings->main) < 0)
(gdb) p settings.main.c_cc[2]
$1 = 0 '\0'
(gdb) n
1161 return 0;
(gdb) p settings.main.c_cc[2]
$2 = 8 '\b'
settings.main.c_cc[2] is settings.main.c_cc[VERASE], and the value
should be ^? according to the terminfo entry.
Doing the exact same thing on a Fedora Core2 GNU/Linux system
settings.main.c_cc[2] is set to ^?, as expected.
Is this a bug in solaris' tcgetattr, or in the way emacs is using it?
Can somebody please take a look?
Thanks.
-dan