You are not logged in.

#1 2009-10-07 05:23:55

odinlake
Member
From: Tokyo
Registered: 2009-09-07
Posts: 12

ctrl+c and neverending ping

I find this problem asked b4 but the proposed solution doesn't work for me (the cause is not, I think, improper stty). In most cases ctrl+c doesn't work. For instance it doesn't interrupt ping. Curiously it stops emacs and a few other apps just fine. The problem is the same at command line w/o X or in at least a couple of terminals I've tried.

# stty -a
speed 38400 baud; rows 98; columns 217; 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; 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

Ctrl+z saves me (always) but then I have to kill the suspended process manually. According to the above I assume that Ctrl+U means a hard kill? Well it doesn't work any better than Ctrl+C. Ctrl+Q/S seem to work but they don't solve my problem.

Any advice, ideas or pointers to where this has been explained before?

Offline

#2 2009-10-07 06:59:23

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: ctrl+c and neverending ping

"kill" just means "erase whole line" for stty.

I don't have a solution, but you could try to do this in bash:

trap 'echo trapped' SIGINT

bash should now echo "trapped" if you hit ^C at the prompt. If it does it means that the terminal correctly sends a SIGINT to bash on ^C, and then you can assume that your stty settings are correct.

Also, what "proposed solution" are you referring to?

Offline

#3 2009-10-07 07:18:34

odinlake
Member
From: Tokyo
Registered: 2009-09-07
Posts: 12

Re: ctrl+c and neverending ping

Sorry for a misstake.. It seems that ^C to works fine at command-line w/o X, but not in X using the terminals I've tried.

hbekel wrote:

trap 'echo trapped' SIGINT
bash should now echo "trapped" if you hit ^C at the prompt.

Thanks for that: Ok, it seems my terminals don't send SIGINT to bash (but the command-line does)... I still see the "^C" outputted e.g. if I hit ctrl+C while "ping" is running. Is emacs picking up on that even though it doesn't receive SIGINT? Too bad ping and co. don't.


hbekel wrote:

Also, what "proposed solution" are you referring to?

The ones suggesting my stty may be set to something else but ^C for interrupt, which would obviously explain why ^C isn't working. That doesn't seem to be the case here though.

Offline

#4 2009-10-07 07:37:17

xsytry
Member
From: Poznan, Poland
Registered: 2008-07-08
Posts: 21

Re: ctrl+c and neverending ping

What WM do you use?


Do, or do not. There is no try. [Yoda]

Offline

#5 2009-10-07 12:15:45

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: ctrl+c and neverending ping

odinlake wrote:
hbekel wrote:

trap 'echo trapped' SIGINT
bash should now echo "trapped" if you hit ^C at the prompt.

Thanks for that: Ok, it seems my terminals don't send SIGINT to bash (but the command-line does)... I still see the "^C" outputted e.g. if I hit ctrl+C while "ping" is running. Is emacs picking up on that even though it doesn't receive SIGINT? Too bad ping and co. don't.

The ^C you see is echoed by the terminal, as a result of stty echoctl. Which means that the terminal seems to see ctrl+c being pressed, but it doesn't result sending a SIGINT to the process it's running. Which is really strange...

What happens if you simply set

stty intr z

Does pressing a plain "z" at least work to interrupt ping?

I'm not sure if it's the stty setting at all... Have you tried comparing the output of stty -a from the console and from your XTerminal?

Offline

#6 2009-10-07 13:35:18

lknix
Member
Registered: 2008-10-20
Posts: 19

Re: ctrl+c and neverending ping

I had the same problem - pressing ^C didn't work in X. I found that it was my VM's fault, I was using awesome-git and when I returned to a stable release the problem was gone.

Offline

#7 2009-10-08 06:55:36

odinlake
Member
From: Tokyo
Registered: 2009-09-07
Posts: 12

Re: ctrl+c and neverending ping

Indeed, the problem was probably connected to the wm ("awesome" as lknix guessed) and it went away after a full system upgrade. I didn't spot awesome among the packages that were upgraded though so I'm not so sure exactly what is to blame, but it hardly matters any more. Sorry for not upgrading before posting but I was so sure it was something I had done myself by messing around, that it never crossed my mind.

Offline

Board footer

Powered by FluxBB