Re: extension_control_path and "directory"

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Cc: Christoph Berg <myon(at)debian(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: extension_control_path and "directory"
Date: 2025-04-24 22:27:37
Message-ID: 546E7C54-D2F4-4DBB-9A06-EBBF90265A2C@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Apr 24, 2025, at 11:18, Matheus Alcantara <matheusssilv97(at)gmail(dot)com> wrote:

> In v2 I've moved the logic to remove the /extension to
> parse_extension_control_file(), do you think that this Assert on this
> function would still be wrong? IIUC we should always have /extension at
> the end of "control_dir" at this place, because the
> extension_control_path GUC will omit the /extension at the end and we
> will force it to have the suffix on the path at
> find_extension_control_filename() and
> get_extension_control_directories() functions. I'm missing something
> here?

I took this patch for a spin and managed to make it core dump. How? Well I installed semver with this command:

```sh
make prefix=/Users/david/Downloads install
```

Then set the search paths and restarted:

```ini
extension_control_path = '/Users/david/Downloads/share/extension:$system'
dynamic_library_path = '/Users/david/Downloads/lib:$libdir'
```

Then I connected and ran `CREATE EXTENSION semver` and it segfaulted. I poked around for a few minutes and realized that my prefix is not what I expected. Because it doesn’t contain the string “postgres”, PGXS helpfully adds it. The actual paths are:

```ini
extension_control_path = '/Users/david/Downloads/share/postgresql/extension:$system'
dynamic_library_path = '/Users/david/Downloads/lib/postgresql:$libdir'
```

With that fix it no longer segafulted.

So I presume something crashes when a directory or file doesn’t exist.

But I am not at all sure we want this prefix behavior for installing extensions. I get that has been the behavior for setting the main sharedir and libdir for Postgres, but I don’t know that it makes sense for extension prefixes.

Best,

David

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2025-04-25 02:03:01 pgsql: doc: simplify new EXPLAIN ANALYZE BUFFERS description
Previous Message Matheus Alcantara 2025-04-24 15:18:28 Re: extension_control_path and "directory"

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2025-04-24 22:59:12 Re: RFC: Additional Directory for Extensions
Previous Message Jelte Fennema-Nio 2025-04-24 22:19:15 Re: Making sslrootcert=system work on Windows psql