From owner-freebsd-current@FreeBSD.ORG Wed Jul 30 07:45:47 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A326A37B401 for ; Wed, 30 Jul 2003 07:45:47 -0700 (PDT) Received: from mailhub01.unibe.ch (mailhub01.unibe.ch [130.92.9.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F14243F85 for ; Wed, 30 Jul 2003 07:45:46 -0700 (PDT) (envelope-from roth@iam.unibe.ch) Received: from localhost (localhost [127.0.0.1]) by mailhub01.unibe.ch (Postfix) with ESMTP id 1A0E025BA5B for ; Wed, 30 Jul 2003 16:45:45 +0200 (MEST) Received: from mailhub01.unibe.ch ([127.0.0.1]) by localhost (mailhub01 [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 12536-01-88 for ; Wed, 30 Jul 2003 16:45:43 +0200 (MEST) Received: from asterix.unibe.ch (asterix.unibe.ch [130.92.64.4]) by mailhub01.unibe.ch (Postfix) with ESMTP id A8E1025BA37 for ; Wed, 30 Jul 2003 16:45:43 +0200 (MEST) Received: from speedy.unibe.ch (speedy [130.92.64.35]) by asterix.unibe.ch (8.11.6+Sun/8.11.6) with ESMTP id h6UEjhK29211 for ; Wed, 30 Jul 2003 16:45:43 +0200 (MET DST) Received: (from roth@localhost) by speedy.unibe.ch (8.11.6+Sun/8.10.2) id h6UEjh723186 for current@freebsd.org; Wed, 30 Jul 2003 16:45:43 +0200 (MEST) Date: Wed, 30 Jul 2003 16:45:42 +0200 From: Tobias Roth To: current@freebsd.org Message-ID: <20030730144542.GA23176@speedy.unibe.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline User-Agent: Mutt/1.4i X-Operating-System: SunOS speedy 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-80 X-Virus-checked: by University of Berne Subject: sh coredump through rc.subr X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2003 14:45:47 -0000 --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--