Bash – Ctrl-C is ignored by pppd when put in a shell script

bashppppppdshell-scriptsignals

I'm trying to connect to GPRS network through a serial port connected GSM modem.

When I call /usr/sbin/pppd call <peer_name> from the command line, it correctly receives and handles Ctrl+C from keyboard.

But when I put the exact same command in an empty shell script (with or without the shebang #! at the top), chmod +x it and run it from the shell prompt, then pppd starts to run – But it totally ignores Ctrl+C key combination. Ctrl+Z works normally though.

This is the contents of the pppd peer file

nodetach
dump
connect "connect_script"
disconnect "disconnect_script"
/dev/ttyS0
noauth

I tested another peer file which I had created to connect to a PPTP VPN server – with the same result. PPTP does not need a chat script, so I'm ruling out problems with chat command or serial port link properties.

OS is debian 7.

Any ideas what is happening here?

Best Answer

I guess the problem is a bug specific to pppd version 2.4.5, which is the one that comes with Debian 7. I tested versions 2.4.4 and 2.4.6 (which is the latest as of now) on the same and other machines and they work as expected. pppd package seems to have a lot of signal handler manipulation code in it, which I guess could lead to these kind of bugs. I'm just happy that it's been fixed by now.

Related Question