Обсуждение: Segmentation fault with pg_restore

Поиск
Список
Период
Сортировка

Segmentation fault with pg_restore

От
Keiko Oda
Дата:
Hello,

I'm seeing "Segmentation fault" with a following pg_restore command, with the certain dump file (attached to this email, I had to remove some data from the file as the dump file contains the data that cannot be shared publicly, but I can reproduce this with full dump file also):

  $ pg_restore -l nocnoc_segfault.dump 
  Segmentation fault: 11

Here is my environment, but I was able to reproduce this in the other place as well (e.g. Ubuntu 14.04):

  Process:               pg_restore [64478]
  Path:                  /usr/local/Cellar/postgresql/9.5.2/bin/pg_restore
  Identifier:            pg_restore
  Version:               0
  Code Type:             X86-64 (Native)
  Parent Process:        bash [55643]
  Responsible:           Terminal [1371]
  OS Version:            Mac OS X 10.11.6 (15G1004)

Here is the environment that the dump file was created:

  Docker image "latest" from https://hub.docker.com/_/postgres/ (version 9.5)
  The creator has the dump file in a container with no volumes, so he extracted the dump using a following command:
    docker exec -t nocnoc_db_1 cat /backup/nocnoc_api_development.dump > nocnoc_api_development.dump
  The backup was taking with a following command:
    pg_dump -Fc --no-acl --no-owner nocnoc_api_development

The dump file's format is dos when you open with vim, and if you change this to unix (:set ff=unix) and save it, the segmentation fault will go away and it gives you an expected error (it raises an error since I removed some data from the dump file, the file is not in the perfect shape. If I tried to restore the full dump file with the unix file format, it works fine):

  $ pg_restore -l nocnoc_unix.dump 
  pg_restore: [custom archiver] could not read from input file: end of file

Please let me know if there is any other information that I could provide.

Thanks!
Keiko Oda
Вложения

Re: Segmentation fault with pg_restore

От
John R Pierce
Дата:
On 9/20/2016 3:30 PM, Keiko Oda wrote:
>     pg_dump -Fc --no-acl --no-owner nocnoc_api_development
>
> The dump file's format is dos....

a -Fc dumpfile's format should be compressed binary, not text.


--
john r pierce, recycling bits in santa cruz

Re: Segmentation fault with pg_restore

От
Peter Geoghegan
Дата:
On Tue, Sep 20, 2016 at 11:41 PM, John R Pierce <pierce@hogranch.com> wrote:
> a -Fc dumpfile's format should be compressed binary, not text.

So? It still shouldn't segfault.

--
Peter Geoghegan

Re: Segmentation fault with pg_restore

От
John R Pierce
Дата:
On 9/20/2016 3:48 PM, Peter Geoghegan wrote:
> On Tue, Sep 20, 2016 at 11:41 PM, John R Pierce<pierce@hogranch.com>  wrote:
>> >a -Fc dumpfile's format should be compressed binary, not text.
> So? It still shouldn't segfault.

my point is, compressed binary files aren't 'DOS' *or* Unix, they are
BINARY, so if vim sees ascii data, you're not looking at the right file.


--
john r pierce, recycling bits in santa cruz

Re: Segmentation fault with pg_restore

От
Tom Lane
Дата:
Keiko Oda <keiko@heroku.com> writes:
> I'm seeing "Segmentation fault" with a following pg_restore command, with
> the certain dump file (attached to this email, I had to remove some data
> from the file as the dump file contains the data that cannot be shared
> publicly, but I can reproduce this with full dump file also):

This file is corrupt.  I think what's happened to it is it went through
a Unix->Windows text conversion, replacing bytes that happened to look
like newlines with \r\n.

The fact that pg_restore segfaulted isn't terribly nice, but the best
we could do is give you some nondescript message saying there's something
wrong with the file ...

            regards, tom lane