Date: Wed, 30 Jul 2003 16:45:42 +0200 From: Tobias Roth <roth@iam.unibe.ch> To: current@freebsd.org Subject: sh coredump through rc.subr Message-ID: <20030730144542.GA23176@speedy.unibe.ch>
next in thread | raw e-mail | index | archive | help
--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
i just managed to get an sh coredump with an rc.d/ script of mine.
here is part of the output of /etc/rc.d/test stop :
/etc/rc.d/test: DEBUG: run_rc_command: evaluating :().
Loading configuration files.
Node type = 15
pid 5183 (sh), uid 0: exited on signal 11 (core dumped)
zsh: segmentation fault (core dumped) /etc/rc.d/test stop
the 'Node type' message comes from sh's eval.c function. my rc.d/test
is attached.
the shell dies after the last command from test_stop(), but before the
next command from run_rc_command(), as far as i can tell.
what i want to do is basically the same that is done by
rc.shutdown: going through rc.d/ in reverse order and calling every
script with a 'stop' argument. my code is almost the same as in
rc.shutdown. if i run test_stop manually (i.e. not through
run_rc_command "$1" at the bottom of my script), everything seems to
work just fine.
can someone help me with this?
thanks, t.
--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Description: /etc/rc.d/test
Content-Disposition: attachment; filename=test
#!/bin/sh
# PROVIDE: test
# BEFORE: rcconf
# KEYWORD: FreeBSD
. /etc/rc.subr
name="test"
rcvar=`set_rcvar`
load_rc_config $name
start_cmd="test_start"
stop_cmd="test_stop"
test_start () {
# do some stuff
}
test_stop () {
files=` rcorder -k FreeBSD /etc/rc.d/* 2>/dev/null `
_revlist=
for _revfile in $files; do
_revlist="$_revfile${script_name_sep}$_revlist"
done
for _rc_elem in $_revlist; do
if [ "${_rc_elem}" = "/etc/rc.d/test" ] ; then
break
fi
run_rc_script $_rc_elem stop
done
}
run_rc_command "$1"
--jRHKVT23PllUwdXP--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030730144542.GA23176>
