Re: pgsql: Exclude unlogged tables from base backups

From: David Steele <david(at)pgmasters(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Exclude unlogged tables from base backups
Date: 2018-03-25 19:46:48
Message-ID: cf8a4117-0b15-9755-0af6-9eae53857fa7@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 3/25/18 3:22 PM, Tom Lane wrote:
> David Steele <david(at)pgmasters(dot)net> writes:
>> On 3/25/18 2:16 PM, Tom Lane wrote:
>>> Buildfarm member skink (valgrind) has reported this during its last couple
>>> of runs:
>
>> I think skink is using large values for rel oids and that has exposed a
>> bug. The strncpy doesn't zero terminate the string if the oid has the
>> max number of characters. At least, I was able to reproduce under those
>> circumstances.
>
> Actually, that code didn't guarantee zero termination under *any*
> circumstances; it only happened to work if the stack contained
> zeroes to start with.

Interesting. strncpy() says it will pad the destination with NULLs when
src is less than the size provided. Perhaps some compilers don't honor
that?

>> The attached should fix it.
>
> Found this in my inbox right after pushing a fix. I did it slightly
> differently, emulating the later rather than earlier calls in reinit.c.
> The earlier ones memset the whole target field because they're concerned
> about being able to hash it, but we don't need that here, just zero
> termination.

Yeah, that's the way I would normally do it, but when I searched
reinit.c the first few hits did memset() so I went with that.

Thanks for taking care of it.

--
-David
david(at)pgmasters(dot)net

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-03-25 19:54:56 Re: pgsql: Exclude unlogged tables from base backups
Previous Message Tom Lane 2018-03-25 19:22:03 Re: pgsql: Exclude unlogged tables from base backups