I've made a transcript of a session that shows some of the strange
consequences of SIGINT'ing a process ..
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww16200\viewh18400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\f0\fs36 \cf0 497 02:38:53 peter ssh -p2222 r...@spadina\
r...@spadina's password: \
\
\
Tomato v1.22.1590\
\
\
BusyBox v1.12.2 (2008-12-05 06:20:11 PST) built-in shell (ash)\
Enter 'help' for a list of built-in commands.\
\
# ### it says ash\
# ps\
PID USER VSZ STAT COMMAND\
1 root 1720 S init noinitrd \
2 root 0 SW [keventd]\
3 root 0 RWN [ksoftirqd_CPU0]\
4 root 0 SW [kswapd]\
5 root 0 SW [bdflush]\
6 root 0 SW [kupdated]\
7 root 0 SW [mtdblockd]\
39 root 1696 S buttons \
81 root 1532 S dropbear -p 22 \
2794 root 1960 S syslogd -L -s 50 \
2798 root 1944 S klogd \
2810 root 1724 S nas /etc/nas.conf /var/run/nas.pid lan \
2818 root 1668 S httpd -s \
2819 root 1972 S crond -l 9 \
2824 root 1244 S rstats \
21105 root 1696 S redial \
21106 root 856 S pppoecd vlan1 -u XXXXXXXXXXXXXXXXXXX -p XXXXXXXX -r 1492 -t 1492 -i 0\
21113 nobody 844 S dnsmasq \
21143 root 1604 S upnp -D -L br0 -W ppp0 -I 60 -A 180 \
21312 root 1600 S dropbear -p 22 \
21313 root 1984 S -sh \
21315 root 1960 R ps \
# ### but ps says sh\
# set\
HOME='/root'\
IFS=' \
'\
LOGNAME='root'\
PATH='/bin:/usr/bin:/sbin:/usr/sbin:/home/root:'\
PPID='21312'\
PS1='# '\
PS2='> '\
PS4='+ '\
PWD='/tmp/home/root'\
SHELL='/bin/sh'\
TERM='xterm-color'\
USER='root'\
_='ps'\
# ### and so does that\
# cat /etc/profile\
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/home/$USER:`nvram get env_path`"\
alias l='ls -lFA'\
alias ll='ls -lF'\
# cat .profile\
cat: can't open '.profile': No such file or directory\
# xyz\
-sh: xyz: not found\
# ### it sure thinks it's sh\
# ps\
PID USER VSZ STAT COMMAND\
1 root 1720 S init noinitrd \
2 root 0 SW [keventd]\
3 root 0 RWN [ksoftirqd_CPU0]\
4 root 0 SW [kswapd]\
5 root 0 SW [bdflush]\
6 root 0 SW [kupdated]\
7 root 0 SW [mtdblockd]\
39 root 1696 S buttons \
81 root 1532 S dropbear -p 22 \
2794 root 1960 S syslogd -L -s 50 \
2798 root 1944 S klogd \
2810 root 1724 S nas /etc/nas.conf /var/run/nas.pid lan \
2818 root 1668 S httpd -s \
2819 root 1972 S crond -l 9 \
2824 root 1244 S rstats \
21105 root 1696 S redial \
21106 root 856 S pppoecd vlan1 -u XXXXXXXXXXXXXXXXXXX -p XXXXXXXX -r 1492 -t 1492 -i 0\
21113 nobody 844 S dnsmasq \
21143 root 1604 S upnp -D -L br0 -W ppp0 -I 60 -A 180 \
21312 root 1600 S dropbear -p 22 \
21313 root 1984 S -sh \
21320 root 1960 R ps \
# echo $$\
21313\
# ping ac.ca\
PING ac.ca (69.90.47.27): 56 data bytes\
64 bytes from 69.90.47.27: seq=0 ttl=43 time=132.217 ms\
64 bytes from 69.90.47.27: seq=1 ttl=43 time=132.336 ms\
# \
--- ac.ca ping statistics ---\
2 packets transmitted, 2 packets received, 0% packet loss\
round-trip min/avg/max = 132.217/132.276/132.336 ms\
\
# ### SIGINT ^C\
# ps\
# ### vampire shell eats my command ...\
# ps\
PID USER VSZ STAT COMMAND\
1 root 1720 S init noinitrd \
2 root 0 SW [keventd]\
3 root 0 RWN [ksoftirqd_CPU0]\
4 root 0 SW [kswapd]\
5 root 0 SW [bdflush]\
6 root 0 SW [kupdated]\
7 root 0 SW [mtdblockd]\
39 root 1696 S buttons \
81 root 1532 S dropbear -p 22 \
2794 root 1960 S syslogd -L -s 50 \
2798 root 1944 S klogd \
2810 root 1724 S nas /etc/nas.conf /var/run/nas.pid lan \
2818 root 1668 S httpd -s \
2819 root 1972 S crond -l 9 \
2824 root 1244 S rstats \
21105 root 1696 S redial \
21106 root 856 S pppoecd vlan1 -u XXXXXXXXXXXXXXXXXXX -p XXXXXXXX -r 1492 -t 1492 -i 0\
21113 nobody 844 S dnsmasq \
21143 root 1604 S upnp -D -L br0 -W ppp0 -I 60 -A 180 \
21312 root 1600 S dropbear -p 22 \
21313 root 1984 S -sh \
21323 root 1984 S -sh \
21325 root 1960 R ps \
# ### 21323 is the vampire -- supposedly my child:\
# grep PPid /proc/21323/status\
PPid: 21313\
# ### let's kill it:\
# kill 21323\
Terminated\
# ### don't believe it ...\
# ps\
# ### hey, a vampire ate my ps\
# ps\
PID USER VSZ STAT COMMAND\
1 root 1720 S init noinitrd \
2 root 0 SW [keventd]\
3 root 0 RWN [ksoftirqd_CPU0]\
4 root 0 SW [kswapd]\
5 root 0 SW [bdflush]\
6 root 0 SW [kupdated]\
7 root 0 SW [mtdblockd]\
39 root 1696 S buttons \
81 root 1532 S dropbear -p 22 \
2794 root 1960 S syslogd -L -s 50 \
2798 root 1944 S klogd \
2810 root 1724 S nas /etc/nas.conf /var/run/nas.pid lan \
2818 root 1668 S httpd -s \
2819 root 1972 S crond -l 9 \
2824 root 1244 S rstats \
21105 root 1696 S redial \
21106 root 856 S pppoecd vlan1 -u XXXXXXXXXXXXXXXXXXX -p XXXXXXXX -r 1492 -t 1492 -i 0\
21113 nobody 844 S dnsmasq \
21143 root 1604 S upnp -D -L br0 -W ppp0 -I 60 -A 180 \
21312 root 1600 S dropbear -p 22 \
21313 root 1984 S -sh \
21329 root 1984 S -sh \
21330 root 1960 R ps \
# ### 21329, eh?\
# kill -9 21329\
Killed\
# ps ### the up-arrow should have retrieved that latest kill line, but it got this ps (which the\
vamp will eat)\
# ### see?\
# ps\
PID USER VSZ STAT COMMAND\
1 root 1720 S init noinitrd \
2 root 0 SW [keventd]\
3 root 0 RWN [ksoftirqd_CPU0]\
4 root 0 SW [kswapd]\
5 root 0 SW [bdflush]\
6 root 0 SW [kupdated]\
7 root 0 SW [mtdblockd]\
39 root 1696 S buttons \
81 root 1532 S dropbear -p 22 \
2794 root 1960 S syslogd -L -s 50 \
2798 root 1944 S klogd \
2810 root 1724 S nas /etc/nas.conf /var/run/nas.pid lan \
2818 root 1668 S httpd -s \
2819 root 1972 S crond -l 9 \
2824 root 1244 S rstats \
21105 root 1696 S redial \
21106 root 856 S pppoecd vlan1 -u XXXXXXXXXXXXXXXXXXX -p XXXXXXXX -r 1492 -t 1492 -i 0\
21113 nobody 844 S dnsmasq \
21143 root 1604 S upnp -D -L br0 -W ppp0 -I 60 -A 180 \
21312 root 1600 S dropbear -p 22 \
21313 root 1984 S -sh \
21333 root 1984 S -sh \
21334 root 1960 R ps \
# kill -USR1 21333\
Stack fault\
# ps ### the up-arrow should have retrieved that latest kill line, but it got this ps (which the\
vamp will eat) ##### -- that's *ONE* up arrow ...\
# ### and of course the vamp ate it\
# \
# exit\
# ### that hungry vamp ...\
# exit\
Connection to spadina closed.\
498 02:52:05 peter \
}
Peter
On 09 Jan 12, at 20:45 , Denys Vlasenko wrote:
On Monday 12 January 2009 22:38, Peter Renzland wrote:
When I interrupt (^C) a looping process (ping, tail -f, or a script
with a while or for loop in it),
busybox version?
.config?
which shell do you use? (busybox has three)
very strange things happen,
including ...
* a phantom sh process is created which has my shell process as its
parent
* the next command line goes "nowhere"
* command history is partly deleted, and CWD may change to an earlier
one
* if the killed script reads from STDIO, it may grab some of my
command lines.
* STTY settings may be erratic -- e.g. no more newlines
* sometimes zombies result.
Attempts to kill these processes may succeed, for some, but one
always
remains, and each time it is killed, it reappears as a new process,
with the killing shell as its parent.
If these loops are run in the BG, they can be killed ok.
I can provide transcripts if necessary, but I thought I'd start by
asking if this is a known condition, perhaps caused by inconsistent
busybox shell feature configuration?
It may be the symproms of standalone mode. I desperately
need more bug reports to debug it.
Please provide more info (see questions above).
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox