mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Fix zero-length reads causing problems for IO filters that did not expect them.
The IoRead object was passing zero-length buffers into the filter processing code but not all the filters were happy about getting them. In particular, the gzip compression filter failed if it was given no input directly after it had flushed all of its buffers. This made the problem rather intermittent even though a zero-length buffer was being passed to the filter at the end of every file. It also explains why tweaking compress-level or buffer-size allowed the file to go through. Since this error was happening after all processing had completed, there does not appear to be any risk that successfully processed files were corrupted. Reported by brunre01, jwpit, Tomasz Kontusz, guruguruguru.
This commit is contained in:
parent
670fa88a98
commit
2d73de1d36
@ -15,6 +15,17 @@
|
||||
<release date="XXXX-XX-XX" version="2.13dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="brunre01"/>
|
||||
<release-item-ideator id="jwpit"/>
|
||||
<release-item-ideator id="tomasz.kontusz"/>
|
||||
<release-item-ideator id="guruguruguru"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Fix zero-length reads causing problems for IO filters that did not expect them.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Fix reliability of error reporting from <cmd>local</cmd>/<cmd>remote</cmd> processes.</p>
|
||||
</release-item>
|
||||
@ -6692,6 +6703,11 @@
|
||||
<contributor-id type="github">baburdick</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="brunre01">
|
||||
<contributor-name-display>brunre01</contributor-name-display>
|
||||
<contributor-id type="github">brunre01</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="bruno.friedmann">
|
||||
<contributor-name-display>Bruno Friedmann</contributor-name-display>
|
||||
<contributor-id type="github">tigerfoot</contributor-id>
|
||||
@ -6791,6 +6807,11 @@
|
||||
<contributor-id type="github">gregscds</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="guruguruguru">
|
||||
<contributor-name-display>guruguruguru</contributor-name-display>
|
||||
<contributor-id type="github">guruguruguru</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="hans.jurgen.schonig">
|
||||
<contributor-name-display>Hans-J&uuml;rgen Sch&ouml;nig</contributor-name-display>
|
||||
</contributor>
|
||||
@ -6863,6 +6884,11 @@
|
||||
<contributor-id type="github">jungle-boogie</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="jwpit">
|
||||
<contributor-name-display>jwpit</contributor-name-display>
|
||||
<contributor-id type="github">jwpit</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="keith.fiske">
|
||||
<contributor-name-display>Keith Fiske</contributor-name-display>
|
||||
<contributor-id type="github">keithf4</contributor-id>
|
||||
@ -7013,6 +7039,11 @@
|
||||
<contributor-id type="github">gintoddic</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="tomasz.kontusz">
|
||||
<contributor-name-display>Tomasz Kontusz</contributor-name-display>
|
||||
<contributor-id type="github">ktosiek</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="thomas.flatley">
|
||||
<contributor-name-display>Thomas Flatley</contributor-name-display>
|
||||
<contributor-id type="github">seadba</contributor-id>
|
||||
|
@ -155,6 +155,7 @@ ioReadInternal(IoRead *this, Buffer *buffer, bool block)
|
||||
this->input = NULL;
|
||||
|
||||
// Process the input buffer (or flush if NULL)
|
||||
if (this->input == NULL || bufUsed(this->input) > 0)
|
||||
ioFilterGroupProcess(this->filterGroup, this->input, buffer);
|
||||
|
||||
// Stop if not blocking -- we don't need to fill the buffer as long as we got some data
|
||||
|
@ -255,11 +255,23 @@ testRun(void)
|
||||
TEST_RESULT_VOID(ioReadFree(read), " free read object");
|
||||
TEST_RESULT_VOID(ioReadFree(NULL), " free null read object");
|
||||
|
||||
// Read a zero-length buffer to be sure it is not passed on to the filter group
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
IoBufferRead *bufferRead = NULL;
|
||||
ioBufferSizeSet(2);
|
||||
buffer = bufNew(2);
|
||||
Buffer *bufferOriginal = bufNewZ("123");
|
||||
Buffer *bufferOriginal = bufNew(0);
|
||||
|
||||
TEST_ASSIGN(bufferRead, ioBufferReadNew(bufferOriginal), "create empty buffer read object");
|
||||
TEST_RESULT_BOOL(ioReadOpen(ioBufferReadIo(bufferRead)), true, " open");
|
||||
TEST_RESULT_BOOL(ioReadEof(ioBufferReadIo(bufferRead)), false, " not eof");
|
||||
TEST_RESULT_SIZE(ioRead(ioBufferReadIo(bufferRead), buffer), 0, " read 0 bytes");
|
||||
TEST_RESULT_BOOL(ioReadEof(ioBufferReadIo(bufferRead)), true, " now eof");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
ioBufferSizeSet(2);
|
||||
buffer = bufNew(2);
|
||||
bufferOriginal = bufNewZ("123");
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user