pgdump tar bug (PG 9.2)

Поиск
Список
Период
Сортировка
От Asif Naeem
Тема pgdump tar bug (PG 9.2)
Дата
Msg-id CACDUQd_0GJpVHxJqLE-B4jJMe-NntMMVbp3xn94F4as6KLxQow@mail.gmail.com
обсуждение исходный текст
Ответы Re: pgdump tar bug (PG 9.2)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

With the following test case pgdump creates a corrupt tar file i.e.

CREATE DATABASE dump_test;
\c dump_test
CREATE TABLE test_table1 (int1 int);
INSERT INTO test_table1 (SELECT * FROM generate_series(1, 1000));
\! pg_dump -F t -f dump_test.tar dump_test

Debugging shows that pg_dump tries to fopen tar file with "w" option that corrupts already opened archive file i.e.

_CloseArchive() -> RestoreArchive() -> SetOutput() -> fopen(filename, PG_BINARY_W);

man fopen
... 
... 
w
    Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. 

This issue is caused by addition of the following code in function _CloseArchive() i.e.
memcpy(ropt, AH->ropt, sizeof(RestoreOptions));

It was intruduced by recent patch is as following i.e.
commit 4317e0246c645f60c39e6572644cff1cb03b4c65
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date:   Tue May 29 23:22:14 2012 -0400
    Rewrite --section option to decouple it from --schema-only/--data-only.

PFA patch. Thanks.

Best Regards,
Muhammad Asif Naeem
Вложения

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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: pg_basebackup --xlog compatibility break