Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBhsS-0003Hf-Mq for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Apr 2018 14:28:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fBhsR-0003ia-KL for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Apr 2018 14:28:03 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBhsR-0003iO-Cy for pgsql-hackers@lists.postgresql.org; Thu, 26 Apr 2018 14:28:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBhsN-0005k9-F5 for pgsql-hackers@postgresql.org; Thu, 26 Apr 2018 14:28:02 +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 w3QERo40022910; Thu, 26 Apr 2018 10:27:50 -0400 From: Tom Lane To: Andreas Karlsson cc: John Naylor , Stas Kelvich , Andrew Dunstan , PostgreSQL Hackers , David Fetter Subject: Re: unused_oids script is broken with bsd sed In-reply-to: <9319.1524749946@sss.pgh.pa.us> References: <37D774E4-FE1F-437E-B3D2-593F314B7505@postgrespro.ru> <34a54c54-9132-1254-2bc3-d3489fb79728@2ndQuadrant.com> <4473.1524665917@sss.pgh.pa.us> <4DE444D1-DDE9-460F-AC2F-EB1B73D94A2D@postgrespro.ru> <26728623-7783-4103-9BED-08D443C1729F@postgrespro.ru> <19973.1524686883@sss.pgh.pa.us> <88a5215f-61c4-0182-7f89-0f0851b0be18@proxel.se> <9319.1524749946@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 26 Apr 2018 09:39:06 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22908.1524752870.1@sss.pgh.pa.us> Date: Thu, 26 Apr 2018 10:27:50 -0400 Message-ID: <22909.1524752870@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Andreas Karlsson writes: >> What about using FindBin (http://perldoc.perl.org/FindBin.html)? > A quick check suggests that that's present in the core perl > distribution pretty far back, so I think it'll work. > Question is, is it any better than John's "dirname(__FILE__)" > solution? I experimented a bit, and found that actually what we seem to need is FindBin::RealBin. That's the only one of these solutions that gives the right answer if someone's put a symlink to unused_oids or duplicate_oids into their PATH --- the other ones give you the directory containing the symlink. Now, maybe that would be an uncommon usage, but it hardly seems out of the question. regards, tom lane