Re: [HACKERS] warning handling in Perl scripts

2012-06-27 Thread David E. Wheeler
On Jun 27, 2012, at 4:07 PM, Andrew Dunstan wrote: > I realise I'm late to this party, but I'm with Robert. The root cause of the > errors should be fixed. > > That's not to say that making warnings fatal might not also be a good idea as > a general defense mechanism. ISTM that if they are fat

Re: [HACKERS] warning handling in Perl scripts

2012-06-27 Thread Andrew Dunstan
On 06/24/2012 04:05 PM, Robert Haas wrote: On Sun, Jun 24, 2012 at 2:40 PM, Peter Eisentraut wrote: Every time I make a change to the structure of the catalog files, genbki.pl produces a bunch of warnings (like "Use of uninitialized value in string eq at genbki.pl line ..."), and produces cor

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Ryan Kelly
On Mon, Jun 25, 2012 at 12:07:55PM -0400, Tom Lane wrote: > "David E. Wheeler" writes: > > Hrm, I think that `use warnings 'FATAL';` might only work for core > > warnings. Which is annoying. I missed what was warning up-thread, but the > > most foolproof way to make all warnings fatal is the ori

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Tom Lane
"David E. Wheeler" writes: > Hrm, I think that `use warnings 'FATAL';` might only work for core warnings. > Which is annoying. I missed what was warning up-thread, but the most > foolproof way to make all warnings fatal is the originally suggested > local $SIG{__WARN__} = sub { die shift };

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread David E. Wheeler
On Jun 25, 2012, at 5:51 PM, Alvaro Herrera wrote: >> However, that works only for the current lexical scope. If there are >> warnings in the code you are calling from the current scope, the use of >> `local $SIG{__WARN__}` is required. > > So lets add 'FATAL' to the already existing "use warni

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Alvaro Herrera
Excerpts from David E. Wheeler's message of lun jun 25 11:23:34 -0400 2012: > On Jun 25, 2012, at 3:35 PM, Tom Lane wrote: > > > +1 for the concept of turning warnings into errors, but is that really > > the cleanest, most idiomatic way to do so in Perl? Sheesh. > > It’s the most backward-compa

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread David E. Wheeler
On Jun 25, 2012, at 3:35 PM, Tom Lane wrote: > +1 for the concept of turning warnings into errors, but is that really > the cleanest, most idiomatic way to do so in Perl? Sheesh. It’s the most backward-compatible, but the most idiomatic way to do it lexically is: use warnings 'FATAL'; How

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Tom Lane
Peter Eisentraut writes: > On sön, 2012-06-24 at 16:05 -0400, Robert Haas wrote: >>> +local $SIG{__WARN__} = sub { die $_[0] }; >> This seems like a band-aid. > I'd think of it as a safety net. +1 for the concept of turning warnings into errors, but is that really the cleanest, most idiomatic

Re: [HACKERS] warning handling in Perl scripts

2012-06-25 Thread Peter Eisentraut
On sön, 2012-06-24 at 16:05 -0400, Robert Haas wrote: > > diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl > > index ebc4825..7d66da9 100644 > > --- a/src/backend/catalog/genbki.pl > > +++ b/src/backend/catalog/genbki.pl > > @@ -19,6 +19,8 @@ > > use strict; > > use warn

Re: [HACKERS] warning handling in Perl scripts

2012-06-24 Thread Robert Haas
On Sun, Jun 24, 2012 at 2:40 PM, Peter Eisentraut wrote: > Every time I make a change to the structure of the catalog files, > genbki.pl produces a bunch of warnings (like "Use of uninitialized value > in string eq at genbki.pl line ..."), and produces corrupted output > files, that are then (poss