[Bug 1428651] Re: termio ioctl returns incorrect value for suspend character
Steven Pemberton
steven at pemberton.nl
Fri Mar 6 10:47:27 UTC 2015
** Attachment added: "Print all 17 chars using tcgetattr"
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1428651/+attachment/4336011/+files/termio3.c
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1428651
Title:
termio ioctl returns incorrect value for suspend character
Status in gcc-defaults package in Ubuntu:
New
Bug description:
When calling ioctl to request some special key bindings, it seems to
return a random value for the Suspend binding (see attached C file).
On my system, if I do a stty -a I get this:
$ stty -a
speed 38400 baud; rows 24; columns 80; 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; flush = ^O; min = 1; time = 0;
-parenb -parodd 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
If I run the enclosed C program, which does an ioctl for TCGETA:
if (ioctl(0, TCGETA, (char*) &sgbuf) == 0) {
and then retrieves the key bindings for interrupt, erase, and suspend
(^C, ^?, and ^Z in the above output). It returns Interrupt and Erase
correctly, but it returns the wrong value for Suspend; each time I run
the program it returns a different value, though it consistently
returns the same (wrong) value within the program:
if ((int) sgbuf.c_cc[VSUSP] != 0377) {
printf("Suspend=%i\n", (int)sgbuf.c_cc[VSUSP]);
}
The program calls the ioctl three times to see if it always returns
the same value within the program. It does.
An example output:
Erase= 127, Interrupt=3, Suspend=31
Erase= 127, Interrupt=3, Suspend=31
Erase= 127, Interrupt=3, Suspend=31
but the next time I run it:
Erase= 127, Interrupt=3, Suspend=171
Erase= 127, Interrupt=3, Suspend=171
Erase= 127, Interrupt=3, Suspend=171
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gcc 4:4.8.2-1ubuntu6
ProcVersionSignature: Ubuntu 3.13.0-46.77-generic 3.13.11-ckt15
Uname: Linux 3.13.0-46-generic x86_64
ApportVersion: 2.14.1-0ubuntu3.7
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Mar 5 14:41:28 2015
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1428651/+subscriptions
More information about the foundations-bugs
mailing list