[ntp:hackers] Replacement of hardcoded file paths.

todd glassey tglassey at earthlink.net
Tue Aug 2 00:46:58 UTC 2011


On 8/1/2011 3:06 PM, Harlan Stenn wrote:
>> It turns out that this is trickier than I thought. Since any filepath
>> given via configure is placed in config.h, I can't really use the standard:
>>
>> #ifndef symbols
>> #define symbol
>> #endif
>>
>> idiom. The problem is that if a definition came from config.h it will
>> have quotes around it, and if it comes from the command line, it will
>> not. There is no easy way to check if the symbol already has quotes.
> I have an idea how to do this but...
Harlan let me ask - as long as you are making key changes to the package 
and its form, it may make sense to unify all the passing constraints. 
Also to look for whether a pre-existing (i.e. default configuration) for 
NTP is reasonable? Perhaps it would be easier to build a NTP CONFIG FILE 
builder as part of the installer and force all of these issues into the 
config file making all of the control models more flattened.

Just a thought.
>> This means that for each symbol that needs to be defined, there needs to
>> be one way to set it, either via configure or not.
> I think I agree with you, and I'm also aware that we're talking about
> the *defaults*, and another choice is to make sure folks use the
> "desired" path in their ntp.conf file.  But I would prefer that we can
> set these things via configure.
>
> Overriding things on the configure command-line invocation just seems
> too fragile to me, at least for production uses.
>
> One thing we could do is use FOO_PATH as the unqouted value, and we
> quote it wherever that is needed (or use a CPP mechanism to provide it
> in conig.h as FOO_PATH_Q or something).
>
> I'm not saying this is a good idea.
>
>> Looking at the list of interesting files paths, there really aren't a
>> lot, and they have obvious analogs to currently defined filepaths in
>> configure.
>>
>> The list of filepaths that I am currently patching is as follows:
>>
>> SAVENAME in sntp from /etc/sntp.pid to /var/run/sntp.pid
>> LOCKNAME in sntp from /etc/sntp.state to /var/ntp/sntp.state
>>
>> CONFIG_FILE in ntp_config.h from /etc/ntp.conf to /etc/inet/ntp.conf
>>
>> INIT_FILE in audio.c from /etc/ntp.audio to /etc/inet/ntp.audio
>>
>> KEYFILE from ntpdate from /etc/ntp.keys to /etc/inet/ntp.keys (2 places)
>>
>> CONFIG_FILE in ntpdate from /etc/ntp.conf to /etc/inet/ntp.conf
>>
>>
>> In the current disto, as near as I can see, SAVENAME and LOCKNAME are no
>> longer used although they are still in the sntp/header.h file. So they
>> don't matter.
> But they should be removed.
>
>> In the current distro, there is also NTP_VAR, which I would define as
>> /var/ntp, and NTP_KEYSDIR, which I would define as /etc/inet.
> Sounds like a job for the loc/* files...
>
> http://www.gnu.org/software/automake/manual/standards.html#Directory-Variables
> is what automake and autoconf follow.
>
> sysconfdir is usually $prefix/etc .
>
> localstatedir is usually $prefix/var .
>
> We can also use some flavor of /var/run/ or /var/db/ .
>
>> Now, of these, NTP_KEYSDIR is already defined as sysconfdir. I would
>> propose that CONFIG_FILE be set to ${sysconfdir}/ntp.conf, INIT_FILE be
>> set to ${sysconfdir}/ntp.audio, KEYFILE set to ${sysconfdir}/ntp.keys
>> and NTP_VAR be set to localstatedir with the default set to
>> $(prefix)/var/NTP.
>>
>> I am not sure about the last one though. The standard default for
>> localstatedir is $(prefix)/var. I don't know how easy it would be to
>> change the default.
> About as easy as it is to change where programs get installed.  So since
> we are making those changes now, I am happy to extend genLocInfo and the
> loc/* files, so we can have the "traditional" behavior spec'd in
> loc/legacy and the new/better behavior going forward.
>
>> Which leads me to the next problem. I have no expertise in autoconf
>> and automake at all. I started fooling with making these changes and I
>> had reasonable good results, but I am not sure if I am doing it
>> right. Is there anyone that knows this stuff that can help me make
>> these changes or willing to do it themselves? Do these changes sound
>> reasonable in the first place?
> Cleanup is good, and I'm happy to help as well.
>
> H
> _______________________________________________
> hackers mailing list
> hackers at lists.ntp.org
> http://lists.ntp.org/listinfo/hackers
>


-- 
Todd S. Glassey
This is from my personal email account and any materials from this account come with personal disclaimers.

Further I OPT OUT of any and all commercial emailings.



More information about the hackers mailing list