BUG #5451: pg_restore doesn't close input .tar archive

Started by Pavlo Golubalmost 16 years ago5 messagesbugs
Jump to latest
#1Pavlo Golub
pavlo.golub@cybertec.at

The following bug has been logged online:

Bug reference: 5451
Logged by: Pavel Golub
Email address: pavel@microolap.com
PostgreSQL version: 8.4.x
Operating system: Windows
Description: pg_restore doesn't close input .tar archive
Details:

pg_restore doesn't close input .tar archive file after restore process.

However, file is closed after pg_restore termination, I suppose it's not
correct behaviour.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavlo Golub (#1)
Re: BUG #5451: pg_restore doesn't close input .tar archive

"Pavel Golub" <pavel@microolap.com> writes:

pg_restore doesn't close input .tar archive file after restore process.
However, file is closed after pg_restore termination, I suppose it's not
correct behaviour.

I'm not sure what distinction you're trying to draw. Do you want us to
add a close() just before exit()? If so, what for?

regards, tom lane

#3Pavlo Golub
pavlo.golub@cybertec.at
In reply to: Tom Lane (#2)
Re: BUG #5451: pg_restore doesn't close input .tar archive

Hello, Tom.

You wrote:

TL> "Pavel Golub" <pavel@microolap.com> writes:

pg_restore doesn't close input .tar archive file after restore process.
However, file is closed after pg_restore termination, I suppose it's not
correct behaviour.

TL> I'm not sure what distinction you're trying to draw. Do you want us to
TL> add a close() just before exit()? If so, what for?

First of all, for uniformity I guess. :) .backup files are closed
properly.

And secondly, I'm using these sources in my project and I
need input file to be closed. Of course, I can find the place
where to insert close() by myself, but I beleive that this must be done in the
official release.

TL> regards, tom lane

--
With best wishes,
Pavel mailto:pavel@gf.microolap.com

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavlo Golub (#3)
Re: BUG #5451: pg_restore doesn't close input .tar archive

Pavel Golub <pavel@microolap.com> writes:

TL> I'm not sure what distinction you're trying to draw. Do you want us to
TL> add a close() just before exit()? If so, what for?

First of all, for uniformity I guess. :) .backup files are closed
properly.

And secondly, I'm using these sources in my project and I
need input file to be closed. Of course, I can find the place
where to insert close() by myself, but I beleive that this must be done in the
official release.

I don't think so. The pg_restore code is not written to be a library.
(Some have proposed making it into one, but there's a lot of work needed
to make that happen.) Even if it were designed as a library, I don't
think it would be the library's job to close the input file --- what
if the surrounding app passes it stdin, for instance?

regards, tom lane

#5Pavlo Golub
pavlo.golub@cybertec.at
In reply to: Tom Lane (#4)
Re: BUG #5451: pg_restore doesn't close input .tar archive

Hello, Tom.

You wrote:

TL> Pavel Golub <pavel@microolap.com> writes:

TL> I'm not sure what distinction you're trying to draw. Do you want us to
TL> add a close() just before exit()? If so, what for?

First of all, for uniformity I guess. :) .backup files are closed
properly.

And secondly, I'm using these sources in my project and I
need input file to be closed. Of course, I can find the place
where to insert close() by myself, but I beleive that this must be done in the
official release.

TL> I don't think so. The pg_restore code is not written to be a library.
TL> (Some have proposed making it into one, but there's a lot of work needed
TL> to make that happen.) Even if it were designed as a library, I don't
TL> think it would be the library's job to close the input file --- what
TL> if the surrounding app passes it stdin, for instance?

But .backup files are closed properly. :) What the difference?

TL> regards, tom lane

--
With best wishes,
Pavel mailto:pavel@gf.microolap.com