automake
[Top][All Lists]
Advanced

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

Re: Baked-in paths


From: John Calcote
Subject: Re: Baked-in paths
Date: Mon, 15 Mar 2010 10:46:50 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

Hi Reuben,

On 3/14/2010 4:29 PM, Reuben Thomas wrote:
I imagine this question has been asked before, but searching the
archives, the net and the manual didn't help me with the following:

I have a C program which loads some scripts at runtime. These are
stored in datadir (e.g. /usr/local/share/prog). But I also want to be
able to run the program from its build directory.

At the moment I bake in the relevant path; I imagine that for "make
install" I have to rebuild the binary, baking in the installation
path, having baked the build directory path in a normal "make".

Is there a recommended way to deal with this situation?


The software packages I've worked on have all been complex enough to warrant a configuration file in the system config directory (/etc, whatever), which is locked down by virtue of its location. Since only the administrator can change the contents of a file in $(sysconfdir), it's not a security issue.

But what this does allow me to do is generate an installed configuration file with reasonable default paths derived from $(prefix) variables. At the same time, I bake default paths into the application, which are also derived from $(prefix) variables and passed on the compiler command line. This allows me to run without a config file, as long as the app is properly installed. Finally, the key benefit is that I can run my program in test mode by supplying an appropriate config file on the command line (./program -c testconfig.ini).

I love the flexibility this system provides, and I don't see any security issues with it, unless your program must be run as root in order to do what it needs to do. In that case, it's not safe to execute it during make check anyway. But it can be executed during make installcheck.

John





reply via email to

[Prev in Thread] Current Thread [Next in Thread]