From owner-freebsd-rc@FreeBSD.ORG Mon Oct 9 12:10:57 2006 Return-Path: X-Original-To: freebsd-rc@hub.freebsd.org Delivered-To: freebsd-rc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B20516A40F for ; Mon, 9 Oct 2006 12:10:57 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DEDB443D97 for ; Mon, 9 Oct 2006 12:10:29 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k99CAT83080364 for ; Mon, 9 Oct 2006 12:10:29 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k99CATDm080360; Mon, 9 Oct 2006 12:10:29 GMT (envelope-from gnats) Date: Mon, 9 Oct 2006 12:10:29 GMT Message-Id: <200610091210.k99CATDm080360@freefall.freebsd.org> To: freebsd-rc@FreeBSD.org From: Yar Tikhiy Cc: Subject: Re: bin/104044: [patch] rc.d/cleartmp works incorrectly X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Yar Tikhiy List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Oct 2006 12:10:57 -0000 The following reply was made to PR bin/104044; it has been noted by GNATS. From: Yar Tikhiy To: Florent Thoumie Cc: Andrey Simonenko , freebsd-rc@freebsd.org, bug-followup@freebsd.org Subject: Re: bin/104044: [patch] rc.d/cleartmp works incorrectly Date: Mon, 9 Oct 2006 16:07:56 +0400 On Mon, Oct 09, 2006 at 11:52:30AM +0100, Florent Thoumie wrote: > On Mon, 2006-10-09 at 09:10 +0000, Andrey Simonenko wrote: > > The following reply was made to PR bin/104044; it has been noted by GNATS. > > > > From: Andrey Simonenko > > To: bug-followup@FreeBSD.org > > Cc: > > Subject: Re: bin/104044: [patch] rc.d/cleartmp works incorrectly > > Date: Mon, 9 Oct 2006 12:07:16 +0300 > > > > Updated version of cleartmp: > > > > 1. Change "rm -rf ..." to "rm -rf -- ..." > > > > 2. Remove cleartmp_X() and createtmp_X() functions. > > Haven't tested it yet but the patch looks good to me. Anybody else to > have a look? The patch looks _almost_ good to me. For the sake of style, I'd rather move the clear_tmp_X block to inside the start method. That would require renaming rcvar to, say, rcvar1 and checking it from the script. E.g.: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ... rcvar1=`set_rcvar clear_tmp` ... cleartmp_start() { if checkyesno ${rcvar1}; then echo "Clearing /tmp." ... elif checkyesno clear_tmp_X; then echo "Clearing /tmp (X related)." rm -rf /tmp/.X[0-9]-lock ${x11_socket_dirs} fi if checkyesno clear_tmp_X; then # Recreate X related directories. mkdir -m 1777 ${x11_socket_dirs} fi } run_rc_command "$1" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% My point is that well-behaved rc.d scripts don't do their job outside of their methods. -- Yar