Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSOmc-0002Ep-AE for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Nov 2018 16:03:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gSOma-0000H2-LW for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Nov 2018 16:03:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSOma-0000Gn-FF for pgsql-bugs@lists.postgresql.org; Thu, 29 Nov 2018 16:03:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSOmX-0000Tu-VE for pgsql-bugs@lists.postgresql.org; Thu, 29 Nov 2018 16:03:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wATG35vO028446; Thu, 29 Nov 2018 11:03:05 -0500 From: Tom Lane To: Jack Kelly cc: Thomas Munro , PostgreSQL mailing lists Subject: Re: BUG #15525: Build failures when compiling Postgres with Make parallelization In-reply-to: <87r2f4jfu0.fsf@jackkelly.name> References: <15525-a30da084f17a1faa@postgresql.org> <31602.1543363896@sss.pgh.pa.us> <87k1kwlvad.fsf@jackkelly.name> <28417.1543458718@sss.pgh.pa.us> <31059.1543461919@sss.pgh.pa.us> <87r2f4jfu0.fsf@jackkelly.name> Comments: In-reply-to Jack Kelly message dated "Thu, 29 Nov 2018 22:14:31 +1100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28444.1543507385.1@sss.pgh.pa.us> Date: Thu, 29 Nov 2018 11:03:05 -0500 Message-ID: <28445.1543507385@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Jack Kelly writes: > Thomas Munro writes: >> As for what could be done about it, it seems like we (or the Nix >> project, in a local patch) could declare individual targets to have >> .LOW_RESOLUTION_TIME: >> https://www.gnu.org/software/make/manual/html_node/Special-Targets.html >> That doesn't seem any better than using "touch" to make a better mtime >> though. In fact it's worse, because it opens you up to the same problems that sub-second timestamps were meant to fix. After sleeping on this, I'm liking the idea of adding "touch" to our rule better. We shouldn't imagine that this problem exists in a vacuum: Apple got that ranlib code from some BSD or other, so it probably exists in similar form elsewhere. And filesystems with sub-second timestamps are getting more common. So it seems likely that this issue could manifest on other combinations than the one we see here. > IMHO, The Nth-degree "correct" thing for the postgresql build system > would be check if the most recent versions are vulnerable, and if so > update the configure script to detect a high-resolution filesystem and a > truncating ranlib, and if that is true for that build, then set a > variable so the Makefiles can conditionally add static libraries to > `.LOW_RESOLUTION_TIME` targets. This seems like a lot of work for > marginal payoff, particularly if releases newer than 9.x are not brittle > in this way. The issue is still there in the same form. I agree that this sketch of the "correct" thing is not going to happen, though. The "touch" fix seems like a far more appropriate level of effort, plus it actually fixes the problem rather than applying a band-aid. (I have checked that "touch" applies a sub-second timestamp on APFS, btw.) > 3. This bug seems to be tickled because two different Makefiles use > attempt to build the same target at the same time, using a tool > (macOS libtool/ranlib, albeit through a recursive $(MAKE) invocation) > that doesn't support subsecond timestamps, on a filesystem that does > (APFS). That's a bit of a corner case. Yeah, this. Under typical circumstances, the worst that would happen is an extra rebuild of the .a file. We're unlucky because two such rebuilds could get launched in parallel, something that I bet is not that common. regards, tom lane