From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Matthias Schmitt <freak002@mmp.lu>
Subject: Re: OSX doesn't accept identical source/target for strcpy() anymore
Date: Mon, 28 Oct 2013 14:11:12 -0400
Message-ID: <7718.1382983872@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoavSKcuuPx-7tbq8+zCwsn9N0TTzzU-OkfLm2uX+jCqmA@mail.gmail.com>
References: <5A871654-B250-4837-99DB-EB6D44E64E65@mmp.lu>
<20131028144225.GG5577@awork2.anarazel.de>
<55D64809-F305-41A9-946B-8EAFF88FBE3B@mmp.lu>
<20131028153750.GH5577@awork2.anarazel.de>
<934199A3-FF2F-4E5E-A8FF-E6F621B6F64D@mmp.lu>
<20131028161132.GA14980@awork2.anarazel.de>
<CA+TgmoavSKcuuPx-7tbq8+zCwsn9N0TTzzU-OkfLm2uX+jCqmA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Oct 28, 2013 at 12:11 PM, Andres Freund <andres@2ndquadrant.com> wrote:
>> There have been previous discussions about fixing strcpy calls with
>> identical source/destination (same for memcpy) but it was deemed not
>> worth the effort. I don't really see an alternative to fixing it now.
> Ugh. Why in the world would Apple break this?
It's broken already; the C and POSIX standards say of strncpy:
If copying takes place between objects that overlap, the behavior is undefined.
Both gcc and glibc have been moving steadily in the direction of
aggressively exploiting "undefined behavior" cases for optimization
purposes. I don't know if there is yet a platform where strncpy with
src == dest behaves oddly, but we'd be foolish to imagine that it's
not going to happen eventually. If anything, Apple is probably doing
us a service by making it obvious where we're failing to adhere to spec.
However ... I still can't replicate this here, and as you say, there's
about zero chance of keeping our code clean of this problem unless we
can set up a buildfarm member that will catch it.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@2ndquadrant.com, pgsql-hackers@postgresql.org, freak002@mmp.lu
Subject: Re: OSX doesn't accept identical source/target for strcpy() anymore
In-Reply-To: <7718.1382983872@sss.pgh.pa.us>
References: <5A871654-B250-4837-99DB-EB6D44E64E65@mmp.lu> <20131028144225.GG5577@awork2.anarazel.de> <55D64809-F305-41A9-946B-8EAFF88FBE3B@mmp.lu> <20131028153750.GH5577@awork2.anarazel.de> <934199A3-FF2F-4E5E-A8FF-E6F621B6F64D@mmp.lu> <20131028161132.GA14980@awork2.anarazel.de> <CA+TgmoavSKcuuPx-7tbq8+zCwsn9N0TTzzU-OkfLm2uX+jCqmA@mail.gmail.com> <7718.1382983872@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox