Re: Initial refactoring of plperl.c - updated

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Initial refactoring of plperl.c - updated
Дата
Msg-id 1263082776.1339.35.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: Initial refactoring of plperl.c - updated  (Tim Bunce <Tim.Bunce@pobox.com>)
Список pgsql-hackers
On sön, 2010-01-10 at 00:03 +0000, Tim Bunce wrote:
> On Sat, Jan 09, 2010 at 11:49:22PM +0000, Tim Bunce wrote:
> > On Sat, Jan 09, 2010 at 11:16:18PM +0200, Peter Eisentraut wrote:
> > > On fre, 2010-01-08 at 12:46 +0000, Tim Bunce wrote:
> > > > *** 45,50 ****
> > > > --- 45,55 ----
> > > >   
> > > >   include $(top_srcdir)/src/Makefile.shlib
> > > >   
> > > > + plperl.o: perlchunks.h
> > > > + 
> > > > + perlchunks.h: plc_*.pl
> > > > +       $(PERL) text2macro.pl --strip='^(\#.*|\s*)$$' plc_*.pl >
> > > > perlchunks.htmp
> > > > +       mv perlchunks.htmp perlchunks.h
> > > >   
> > > >   all: all-lib
> > > 
> > > What's the reason for the temp file here?
> > 
> > Defensive. If the text2macro.pl program fails/dies then you'd be left
> > with a broken output file with a newer timestamp, so the next make
> > wouldn't rerun text2macro.pl.
> 
> An alternative would be for text2macro.pl to write to a temp file and
> rename at the end.

Sounds better.  I think any program should be written such that it
doesn't produce an output file at all if it cannot produce a correct
output file.  So use a temp file or a trap or something like that.  The
makefile should not have to clean up after everyone.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Feature patch 1 for plperl [PATCH]
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: mailing list archiver chewing patches