Date: 30 Sep 2001 22:01:03 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Will Andrews <will@physics.purdue.edu> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/etc rc Message-ID: <xzp3d54qwhs.fsf@flood.ping.uio.no> In-Reply-To: <20010930122429.G40556@curie.physics.purdue.edu> References: <200109250155.f8P1tMR19221@freefall.freebsd.org> <20010930160801.A30603@alaska.cert.siemens.de> <20010930122429.G40556@curie.physics.purdue.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Will Andrews <will@physics.purdue.edu> writes:
> On Sun, Sep 30, 2001 at 04:08:01PM +0200, Udo Schweigert (udo.schweigert@siemens.com) wrote:
> Shouldn't that be:
> > --- rc.orig Sun Sep 30 15:39:29 2001
> > +++ rc Sun Sep 30 15:53:33 2001
> > @@ -807,7 +807,9 @@
> > trap 'exit 1' 2
> > ${script} start)
> > else
> > - echo "Skipping ${script}, not executable"
> > + if [ -f "${script}" ]; then
> if [ ! -x '${script}" ]; then
No, because Bourne shell derivatives (at least those that try to be
POSIX compatible) all share an annoying bug^H^H^Hfeature: they
silently ignore globbing failures, so if there are no files in the
directory, the loop will still run once with $script set to the glob
expression itself. Using -f will catch that, using ! -x won't.
On the other hand, -f won't account for symlinks, so
if [ -f "${script} -or -l "${script}" ]; then
is probably better.
One other thing is that the convention for rc.d scripts is to print
their name preceded by a space, with no newline. The "Skipping..."
stuff breaks that:
Local package initialization: foo barSkipping /usr/local/etc/rc.d/baz.sh, not executable
quux quuux.
...so the echo itself should be changed to something like:
echo -n " (skipping "${script##*/})"
which will give
Local package initialization: foo bar (skipping baz.sh) quux quuux.
DES
--
Dag-Erling Smorgrav - des@ofug.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp3d54qwhs.fsf>
