Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VarWp-0007kT-Ck for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2013 18:27:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VarWo-0005cC-Rt for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2013 18:27:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VarWm-0005Zk-92 for pgsql-hackers@postgresql.org; Mon, 28 Oct 2013 18:27:00 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VarWj-0006VX-3g for pgsql-hackers@postgresql.org; Mon, 28 Oct 2013 18:26:59 +0000 Received: from anarazel.de (p5DDC7390.dip0.t-ipconnect.de [93.220.115.144]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MUClm-1V9wyK1kRe-00QcaP; Mon, 28 Oct 2013 19:26:54 +0100 Received: by anarazel.de (Postfix, from userid 1000) id CCE9C102004; Mon, 28 Oct 2013 19:26:53 +0100 (CET) Date: Mon, 28 Oct 2013 19:26:53 +0100 From: Andres Freund To: Tom Lane Cc: Robert Haas , "pgsql-hackers@postgresql.org" , Matthias Schmitt Subject: Re: OSX doesn't accept identical source/target for strcpy() anymore Message-ID: <20131028182653.GD20248@awork2.anarazel.de> 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> <7718.1382983872@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7718.1382983872@sss.pgh.pa.us> X-Provags-ID: V02:K0:6JIh2qtYHK0yx+yeqyVtTgE30Lsdp8BFgrk07Hyo6jI f1LriK4xDNmgpJWUIPIGLpGhxA+q0nQVd/A2PBclZkcm3PlVLK IkVXIGj2G79P0Sg8x4hDWJHTdwHnZkuvdvj3R1WDMQ7K9/nGyB OZN4wNPbHWtNJ0CVctUARW+BNKGHjbBtbGApZwOkcRqedRICXb dnGsgG/c1fW61mollErSPnkRUT0Gr8d8V2xqwpmCY2tM+Sg8Jz 6+lyqdPkxYELsiTYZQSYIu+V3hN8NK6UCd56Sm9piP7RrH0ZSY glqt/07adskr9VvbI0ZXp4RPsRO7ivh2ALNTTB4CQhO6Wvodzv CQHoFqx88I1a5YSXVimucumB9HNhU+lNW+WdHzaIS X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2013-10-28 14:11:12 -0400, Tom Lane wrote: > Robert Haas writes: > > On Mon, Oct 28, 2013 at 12:11 PM, Andres Freund 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. It'd be neat if we could get a buildfarm animal up that uses valgrind - which would catch such and lots of other errors. That's where the topic has come up in the past: http://www.postgresql.org/message-id/20110312133224.GA7833%40tornado.gateway.2wire.net http://www.postgresql.org/message-id/20130217142209.GA5073@awork2.anarazel.de Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers