Thread: ecpg leaves broken files around

ecpg leaves broken files around

From
Magnus Hagander
Date:
When working on the ecpg regression stuff things, it's the first time
I've actually used ecpg. And I notice now that it leaves incomplete and
broken files around when it fails. For example, I currently get:   parser.pgc:26: ERROR: syntax error at or near
"NULLS"

when building. I have to investigate why later, but when I run ecpg on
this it leaves a parser.c file around, which the build system on the
next run picks up as there and doesn't try to rebuild. Naturally, it
fails later when the C compiler tries to build this file.

AFAIK, most other compilers delete their output if it's not valid. Is
there any particular reason why ecpg doesn't do this?


//Magnus



Re: ecpg leaves broken files around

From
Michael Meskes
Date:
On Sun, Jun 10, 2007 at 09:56:44PM +0200, Magnus Hagander wrote:
> AFAIK, most other compilers delete their output if it's not valid. Is
> there any particular reason why ecpg doesn't do this?

No, not really. Sometimes it comes handy to see what was already
processed, but you're right, it's not what I would expect from a
compiler either.

Any objects changing this behaviour?

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: ecpg leaves broken files around

From
Magnus Hagander
Date:
On Mon, Jun 11, 2007 at 08:05:16AM +0200, Michael Meskes wrote:
> On Sun, Jun 10, 2007 at 09:56:44PM +0200, Magnus Hagander wrote:
> > AFAIK, most other compilers delete their output if it's not valid. Is
> > there any particular reason why ecpg doesn't do this?
> 
> No, not really. Sometimes it comes handy to see what was already
> processed, but you're right, it's not what I would expect from a
> compiler either.
> 
> Any objects changing this behaviour?

Certainly not from me :)

If you find the other behaviour useful, perhaps add a commandline switch
that makes it leave the file around? Just make the
remove-the-file-on-failure default.

Oh, and it seems if you want to keep the feature, it needs fixing. It looks
like ecpg doesn't flush/close the file descriptor before error-exit, so the
file that drops out isn't even complete up to the point of error. At least
that's what it looks like from a quick glance - it ends mid-row on
something that's not related to the error itself.

//Magnus


Re: ecpg leaves broken files around

From
Michael Meskes
Date:
On Mon, Jun 11, 2007 at 10:03:57AM +0200, Magnus Hagander wrote:
> If you find the other behaviour useful, perhaps add a commandline switch
> that makes it leave the file around? Just make the
> remove-the-file-on-failure default.

Should be fixed now. I don't think such a command line switch is needed.
After all you could run ecpg with "-o -" and make it output to stdout.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!