Re: BUG #6134: pg_restore failed with "corrupt tar header"

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-bugs(at)postgresql(dot)org>,"Gene Lum" <gene(dot)lum(at)rsa(dot)com>
Subject: Re: BUG #6134: pg_restore failed with "corrupt tar header"
Date: 2011-07-29 17:16:44
Message-ID: 4E32A4AC020000250003F8E3@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Gene Lum" <gene(dot)lum(at)rsa(dot)com> wrote:

> PostgreSQL version: 9.0
> Operating system: Windows 7 (32-bit)

> I tried to import an output tar file from pg_dump (same version)
> using pg_restore. I can import using the command line without
> problem. I can also execute the command through a Java process by
> specifying the filename without problem.
>
> However, if I execute the command through a Java process and pipe
> in the file contents to the stdin of the process, the command
> failed with this error:
>
> Error: pg_restore: [tar archiver] corrupt tar header found in
> PGDMP (expected 364, computed 19903) file position 256
>
> I used the same method on Unix without problem. This only happened
> on Windows.

As I understand you:

(1) If you run pg_restore from the command line it works.

(2) If you run pg_restore from within Java, passing the file name
on the -f switch it works.

(3) If you run pg_restore from within Java, piping the file in to
the spawned process it works under Unix but not Windows.

My first guess would be that Windows is treating the input as a
*character* stream rather than a *byte* stream. You should check
whether that is something you can control when you launch the
process in Java. Or do you have some reason to believe that this
would be under control of the pg_restore executable?

-Kevin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message andre luiz 2011-07-31 02:55:39 BUG #6135: I wander in the backup of the bank, Portuguese generation of characters, atmosphere windows xp, post
Previous Message Gene Lum 2011-07-29 15:44:36 BUG #6134: pg_restore failed with "corrupt tar header"