Re: WIP pgindent replacement

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP pgindent replacement
Date: 2012-08-03 14:51:21
Message-ID: 20120803145121.GA12815@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 3, 2012 at 10:33:21AM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-08-03 14:56:35 CreateLockFile() race condition
Previous Message Robert Haas 2012-08-03 14:48:17 Re: WIP pgindent replacement