bin/104044: [patch] rc.d/cleartmp works incorrectly
Yar Tikhiy
yar at comp.chem.msu.su
Mon Oct 9 05:10:57 PDT 2006
The following reply was made to PR bin/104044; it has been noted by GNATS.
From: Yar Tikhiy <yar at comp.chem.msu.su>
To: Florent Thoumie <flz at xbsd.org>
Cc: Andrey Simonenko <simon at comsys.ntu-kpi.kiev.ua>, freebsd-rc at freebsd.org,
bug-followup at 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 <simon at comsys.ntu-kpi.kiev.ua>
> > To: bug-followup at 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
More information about the freebsd-rc
mailing list