Re: WIP pgindent replacement - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: WIP pgindent replacement
Date
Msg-id 20120803145121.GA12815@momjian.us
Whole thread Raw
In response to Re: WIP pgindent replacement  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: WIP pgindent replacement
List pgsql-hackers
On Fri, Aug  3, 2012 at 10:33:21AM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Fri, Aug  3, 2012 at 08:26:50AM -0400, Andrew Dunstan wrote:
> >> I think we generally don't put file type extensions on commands, so
> >> this should probably just be renamed pgindent. If someone wants to
> >> go back to the old shell script they can still get it from git.
> 
> > Of course.  I was just noticing that most of the Perl scripts in
> > /src/tools and src/tools/msvc have a .pl extension on the file name, so
> > I was following that style.  Is that valid?
> 
> Well, you're replacing the old script, so it has to keep the same name.
> 
> IMO adding such an extension to an executable script isn't a terribly
> good practice, because it turns what ought to be an implementation
> detail into part of the script's API.  Had the shell script been named
> pgindent.sh to begin with, we'd now be stuck with the unpalatable
> alternatives of changing the name or using an extension that lies
> about the implementation language.  I don't much care for putting
> in an assumption that the Perl implementation will never be replaced,
> either.

OK, sure, we can keep the pgindent name --- I was just trying to be
consistent.  One problem with the lack of an extension is that there is
no easy way for the Perl cleanup instructions to find all the Perl
executables --- right now it looks for an extension.  Do we have other
Perl scripts in our tree that don't end in *.pl or *.pm?  I didn't find
any with this script:
$ find . -type f -exec file {} \;|grep Perl./src/backend/catalog/Catalog.pm: Perl5 module source
text./src/tools/msvc/MSBuildProject.pm:Perl5 module source text./src/tools/msvc/Project.pm: Perl5 module source
text./src/tools/msvc/Mkvcbuild.pm:Perl5 module source text./src/tools/msvc/Install.pm: Perl5 module source
text./src/tools/msvc/Solution.pm:Perl5 module source text./src/tools/msvc/VCBuildProject.pm: Perl5 module source
text./src/tools/msvc/VSObjectFactory.pm:Perl5 module source text
 

We can hard-code pgindent as one we chould perltidy.

FYI, personally, I have never been a big fan of using *.pl for things I
normally run, like scripts in /usr/local/bin, but I sometimes use *.pl
for utility stuff.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP pgindent replacement
Next
From: Noah Misch
Date:
Subject: CreateLockFile() race condition