NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: misc/47251: rc.d script using _chdir silently crashes

The following reply was made to PR misc/47251; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
Subject: Re: misc/47251: rc.d script using _chdir silently crashes
Date: Tue, 27 Nov 2012 09:05:48 +0700

     Date:        Mon, 26 Nov 2012 22:10:01 +0000 (UTC)
     Message-ID:  <>
   | I could not get a home-written /etc/rc.d/name script to work for
   | an application that uses ${name}_chdir shell variable.
 I think you're misunderstanding the use and purpse of that variable.
 If I have it right, ${name}_chdir is intended to set the directory that
 will be used (chdir'd do) before the command is run - but only then.
 You are assuming that the script will chdir to that directory before doing
 anthing else - like testing whether the command exists, etc.   It doesn't.
 You don't get to refer to the command ysing a relative path from
 ${name}_chdir (or anything else using it) - that's just what will be
 the command's working directory, after it starts.
 For the script, you should assume you have no idea what directory you're
 running in, and use full path names (or $PATH) to resolve filenames.

Home | Main Index | Thread Index | Old Index