Thread: pgcrypto: Makefile check

pgcrypto: Makefile check

From
Neil Conway
Date:
This patch makes the pgcrypto Makefile check that a recognized random
source has been defined. If no such source is defined, pgcrypto will
compile successfully but will be unusable.

(An alternative place to do the check would be in random.c; comments on
which location is preferrable are welcome.)

Barring any objections I will apply this to HEAD later tonight.

-Neil


Attachment

Re: pgcrypto: Makefile check

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> This patch makes the pgcrypto Makefile check that a recognized random
> source has been defined. If no such source is defined, pgcrypto will
> compile successfully but will be unusable.

Oh?

> +$(error "Unrecognized random source: $(random)")

Doesn't look like a successful compile to me.  What's worse, this would
also cause maintenance operations (like "make clean") to fail.

(I see little point in this anyway given that the makefile defaults to
"random = silly" further up.)

            regards, tom lane

Re: pgcrypto: Makefile check

From
Neil Conway
Date:
Perhaps I wasn't clear: the *present* behavior of pgcrypto is to
"compile successfully but ... be unusable" if an invalid random source
is defined. This is prone to error. That patch changes this behavior to
refuse to compile if an invalid random source has been defined.

On Mon, 2004-11-22 at 10:46 -0500, Tom Lane wrote:
> > +$(error "Unrecognized random source: $(random)")
>
> Doesn't look like a successful compile to me.

Right, that's the whole point.

> What's worse, this would also cause maintenance operations (like
> "make clean") to fail.

I don't think this is a problem (an invalid random source is effectively
a misconfiguration and could only be the result of user error). But if
you like I can change the patch so that we error out when attempting to
compile random.c

> (I see little point in this anyway given that the makefile defaults to
> "random = silly" further up.)

This patch was specifically motivated by a user who was confused when
they edited the Makefile, compiled pgcrypto, and couldn't use it -- as
it turned out the random source was defined with trailing whitespace. I
think the Makefile syntax is sufficiently esoteric that some error
checking would be helpful.

-Neil



Re: pgcrypto: Makefile check

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> Perhaps I wasn't clear: the *present* behavior of pgcrypto is to
> "compile successfully but ... be unusable" if an invalid random source
> is defined. This is prone to error. That patch changes this behavior to
> refuse to compile if an invalid random source has been defined.

Ah, got it.

> I don't think this is a problem (an invalid random source is effectively
> a misconfiguration and could only be the result of user error). But if
> you like I can change the patch so that we error out when attempting to
> compile random.c

Please do; I dislike makefiles that won't "make clean" ...

            regards, tom lane

Re: pgcrypto: Makefile check

From
Neil Conway
Date:
On Mon, 2004-11-22 at 19:10 -0500, Tom Lane wrote:
> Please do; I dislike makefiles that won't "make clean" ...

Attached is a revised patch. Will apply in a few hours barring any
objections.

-Neil


Attachment

Re: pgcrypto: Makefile check

From
Neil Conway
Date:
On Tue, 2004-11-23 at 11:24 +1100, Neil Conway wrote:
> Attached is a revised patch. Will apply in a few hours barring any
> objections.

Applied.

-Neil