Re: Parsing config files in a directory

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Magnus Hagander <magnus(at)hagander(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parsing config files in a directory
Date: 2009-10-27 03:19:46
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Smith <gsmith(at)gregsmith(dot)com> writes:
> On Mon, 26 Oct 2009, Greg Stark wrote:
>> When scanning postgresql.conf.d we should follow the Apache/Debian
>> standard of scanning only files which match a single simple hard-coded
>> template.

> If the default glob pattern is *.conf, won't all those already be screened
> out? I can see your point that letting it be adustable will inevitably
> result in some fool one day writing a bad matching pattern that does grab
> backup/lock files. But is that concern so important that we should limit
> what people who know what they're doing are allowed to do?

I'm with Greg Stark on this: let's just specify a directory name and
hard-wire the filename pattern as *.conf. The use-case for anything
else is at best tissue-thin and at worst counterproductive. More,
AFAICS it is going to take us a substantial amount of code to do
something more general. (We already touched on the question of whether
glob(3) is portable, and even if it is, we have to consider the code
that will need to be added to ensure it's cleaned up on error.
A ReadDir loop around a strncmp call is no problem from that point of
view, because we already have that infrastructure; but ensuring
globfree() happens is another question.)

> I object to the idea of dictating in this area because it just
> encourages argument.

I quite agree with that as a general principle, but I don't think that
dictating the filename pattern is really limiting people in any
discernible fashion.

regards, tom lane

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Kiswono Prayogo 2009-10-27 03:29:46 half OOT, plv8js group created ^^
Previous Message Greg Stark 2009-10-27 03:16:56 Re: Parsing config files in a directory