From owner-cvs-all Sun Sep 30 13: 1:16 2001 Delivered-To: cvs-all@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 23F3D37B40A; Sun, 30 Sep 2001 13:01:08 -0700 (PDT) Received: (from des@localhost) by flood.ping.uio.no (8.9.3/8.9.3) id WAA31185; Sun, 30 Sep 2001 22:01:04 +0200 (CEST) (envelope-from des@ofug.org) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Will Andrews Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/etc rc References: <200109250155.f8P1tMR19221@freefall.freebsd.org> <20010930160801.A30603@alaska.cert.siemens.de> <20010930122429.G40556@curie.physics.purdue.edu> From: Dag-Erling Smorgrav Date: 30 Sep 2001 22:01:03 +0200 In-Reply-To: <20010930122429.G40556@curie.physics.purdue.edu> Message-ID: Lines: 43 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Will Andrews 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