src/ports/pgcheckdir.c - Ignore dot directories...

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: src/ports/pgcheckdir.c - Ignore dot directories...
Date: 2013-02-05 08:36:33
Message-ID: A37DC83F-75AA-4850-8261-AD16B104F044@chittenden.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello. This was bounced my way via IRC[1] and I'm kicking an updated version of the patch upstream for review and committing.

Currently src/port/pgcheckdir.c will reject non-empty directories, which is an issue during initdb(1) when PGDATA is also the mount point for filesystems that support snapshots (e.g. ZFS or UFS2). The original patch to the FreeBSD ports team excluded ".snap", but this seems limited.

Instead, it seems more correct to simply ignore all directories that begin with a dot character. I'm not aware of any special directories exposed by filesystems that aren't dot directories so this seems like a relatively futureproof solution, too.

Granted it's not hard to create a subdirectory, initdb there and move the contents of the files around, it's extra work that shouldn't be required. By UNIX convention, files/directories beginning with a dot are hidden anyway, and since PostgreSQL isn't using or creating any dot files or directories, this seems like the right trade off in usability.

Here's a quick reproduction of the problem along with the patch.

Attachment Content-Type Size
src-port-pgcheckdir.c.patch application/octet-stream 437 bytes
unknown_filename text/plain 889 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-02-05 08:42:52 Re: pgsql: Stamp 9.1.8.
Previous Message Andrew Dunstan 2013-02-05 08:26:41 Re: json api WIP patch