Viewing entries tagged with pgindent. Return to full view.

pgindent vs dash

For those who don't know, pgindent is the tool used to indent the source code of PostgreSQL. dash is the shell that ships as /bin/sh on at least Ubuntu.

pgindent requires indent from BSD (we use a patched version from NetBSD, the source is available on the PostgreSQL ftp site), and specifically does not work with GNU indent. Guess what Ubuntu ships with.

The solution is of course a small script that runs BSD indent from a different directory, and also points out the typedefs.list file from the PostgreSQL git repo. Something like this:

#!/bin/sh

export PATH=src/tools/pgindent:$PATH
src/tools/pgindent/pgindent src/tools/pgindent/typedefs.list $*

Spot the error? Yeah, that calls /bin/sh, which is dash. Which gives some really interesting results with pgindent, none of which are what you expect.

So if you run pgindent through a script like this, be sure to use /bin/bash and not /bin/sh!

Conferences

I speak at and organize conferences around Open Source in general and PostgreSQL in particular.

Upcoming

SCaLE 2023
Mar 9-12, 2023
Pasadena, CA, USA
Nordic PGDay 2023
Mar 21, 2023
Stockholm, Sweden
pgday.Paris 2023
Mar 23, 2023
Paris, France
PGCon 2023
May 30-Jun 2, 2023
Ottawa, Canada
PGConf.EU 2023
Dec 12-15, 2023
Prague, Czechia

Past

FOSDEM 2023
Feb 2-5, 2023
Brussels, Belgium
PGConf.EU 2022
Oct 25-28, 2022
Berlin, Germany
PGConf.NYC 2022
Sep 22-23, 2022
New York, USA
Swiss PGDay 2022
Jul 1, 2022
Rapperswil, Switzerland
pgCon 2022
May 24-27, 2022
Online, Online
More past conferences