extension_control_path: ignore empty elements and deduplicate directories

Started by Chao Li20 days ago18 messageshackers
Jump to latest
#1Chao Li
li.evan.chao@gmail.com

Hi,

While reviewing patch [1]/messages/by-id/CABkiuWpGiLzDg4D8zRBJ6DHnwYgHqkFxz2gDstXgeOdzh6bdZQ@mail.gmail.com, I noticed two issues with extension path population.

1. Empty path elements are silently interpreted as "/extension"

Say a user sets extension_control_path = '$system:', it will be interpreted as two paths: $system and an empty string, and the empty string will be expanded to "/extension". Since "/extension" is an absolute path, it will be searched for extensions. If the host machine doesn't have "/extension", the path will be silently ignored; but if the directory happens to exist, it will be searched for extensions, which doesn't sound desirable, because the user might not be aware of that at all.

Adding a trailing colon is an easy mistake to make, but silently searching "/extension" is unintended behavior. So I think we should silently discard empty path elements. An entirely empty string ('') is interpreted as $system as documented, and that behavior should be retained.

2. It may read the same directory more than once

Say a user sets extension_control_path = '$system:$system', that's an obvious duplicate path, but the current implementation will scan $system twice when listing available extensions, and only deduplicate extension names later.

There is no correctness problem here, but deduplicating search paths may avoid unnecessary directory reads. I think this is a relatively low-priority but useful optimization.

I split the fixes into two commits, so that committers can handle them separately.

I added DEBUG3 logging to print the paths to search, mainly so the tests can verify them. It also allows users to view the expanded search paths.

[1]: /messages/by-id/CABkiuWpGiLzDg4D8zRBJ6DHnwYgHqkFxz2gDstXgeOdzh6bdZQ@mail.gmail.com

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254536_1
v1-0001-Ignore-empty-elements-in-extension_control_path.patchapplication/octet-stream; name=v1-0001-Ignore-empty-elements-in-extension_control_path.patch; x-unix-mode=0644Download+41-2
v1-0002-Deduplicate-extension-control-search-directories.patchapplication/octet-stream; name=v1-0002-Deduplicate-extension-control-search-directories.patch; x-unix-mode=0644Download+63-14
#2Prashant Chinnam
crprashant@hotmail.com
In reply to: Chao Li (#1)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi Chao,

I have read v1 (both patches), reproduced both problems
on current master, and tested the fix; my reading agrees
with yours and I think the patches are ready.

The mechanism, as I understand it:
get_extension_control_directories() is the one place
that splits extension_control_path into directories.
An empty element is passed through
psprintf("%s/extension", piece) like any other element,
so it produces the literal directory "/extension", which
is then searched and can supply extensions. Duplicate
directories are likewise kept as separate list entries
and rescanned on every lookup; the duplication only
becomes invisible later, when the SRFs dedup by
extension name. Your fix works at the right layer:
empty elements are skipped while the list is built, and
directories are compared after macro expansion and
canonicalization, keeping the first occurrence and its
display metadata.

Reproduction on unpatched master (c07545df, a few
commits past the patch's base eaa5961; v1 applies
cleanly there and I tested your exact commits from the
CFBot branch). I planted a dummy extension in a real
/extension directory at the filesystem root. With
extension_control_path = '$system:' :

SELECT name, default_version, location
FROM pg_available_extensions
WHERE name = 'dummyext';
dummyext | 1.0 | /extension

CREATE EXTENSION dummyext; -- succeeds

The same listing appears for ':$system', for ':'
alone, and for '$system::$system' -- every empty
element adds /extension to the search path. For the
duplicate problem I attached strace to the postmaster
during one pg_available_extensions call with
'$system:$system': the system extension directory was
opened for scanning exactly twice in that single call.

With v1 applied, the identical probes give:
SELECT name, default_version, location
FROM pg_available_extensions
WHERE name = 'dummyext';
(0 rows)

CREATE EXTENSION dummyext;
ERROR: extension "dummyext" is not available

for all four path shapes above, and the strace count
for '$system:$system' drops to exactly one directory
open. The documented special case is preserved:
extension_control_path = '' still means $system
(plpgsql lists with location $system, and the dummy
extension is not found). ':' alone now searches no
directories, which matches the sentence the patch adds
to the documentation, and I confirmed the doc wording
against the behaviour. I also checked duplicates
spelled differently: a custom directory repeated with
a trailing '/.' canonicalizes to one entry, and
'$system' listed alongside the literal system share
directory dedups to one entry that still reports its
location as $system -- the first occurrence really is
kept, as the second commit message says. One boundary
I noted: an element must equal "$system" exactly to get
macro substitution, so '$system/.' behaves as a literal
path, exactly as it did before the patch; and a
whitespace-only element is not treated as empty. Both
are pre-existing semantics, not regressions.

Scope check: I grepped the tree for every user of the
Extension_control_path value. extension.c is the only
code that reads or splits it, and all four consumers --
find_extension_control_filename() behind CREATE
EXTENSION, pg_available_extensions,
pg_available_extension_versions, and
extension_file_exists() -- go through the one function
you patch. The fix is complete as it stands.

On the DEBUG3 logging: I think it earns its place. It
is one elog per surviving directory, invisible unless
someone asks for debug3, and it is also the only
observability into which directories are actually
searched -- without it, the dedup half of this patch
would have almost no testable surface. One caveat
about the tests rather than the code: the TAP test's
"empty elements should not search /extension" checks
are unlike() assertions on that DEBUG3 output, so on
unpatched code they pass vacuously (master emits no
such messages at all). The companion like() checks and
the duplicate-count checks do fail on master, and my
probes above pin the actual behaviour independently,
so this is a small test-strength note, not an objection.

Tests: the new TAP cases cover both
pg_available_extensions and
pg_available_extension_versions for dedup (in both
directory orders) and the empty-element shapes via the
DEBUG3 output; CREATE EXTENSION itself goes through
the same function and I verified it by probe in both
directions. With the patched test file run against
unpatched code, the test fails 6 of its 25 subtests --
exactly the new assertions -- and passes 25/25 with the
patch. In check mode (meson test) the core regression,
isolation, and test_extensions suites pass on both
unpatched master and the patched build. I also ran
make installcheck-world against an installed patched
build: it completed with no failures, 658 tests across
54 suites, including core regression 239/239 and
isolation 134/134. That build had TAP tests disabled,
so the TAP suites did not run there (they did run, and
pass, in the meson build above), and the
pg_stat_statements and test_decoding installcheck
targets were no-ops. CFBot is green on v1 as well.

Small notes, none blocking: the two commit messages
explain the changes well and the split into two commits
is clean, but neither carries a Discussion: trailer.
And since extension_control_path is new in PostgreSQL
18 (commit 4f7f7b03758), both bugs also exist in 18 and
19; how far to backpatch I will leave to the committer.

For the hands-on part I used AI assistance: the builds,
the probe battery, and the test-suite runs were done
with AI assistance, and I reviewed the results and the
patch itself as described above.

Verdict: I am marking this Ready for Committer.

Regards,
Prashant Chinnam

#3surya poondla
suryapoondla4@gmail.com
In reply to: Chao Li (#1)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi Chao,

I tested v1 on 0607aa61090, and did some extra code reading for this. A few
comments:

1. The new DEBUG3 message exposes the expanded paths to non-superusers.
Since f3c9e341cdf commit, pg_available_extensions shows <insufficient
privilege> as the location to them, and since your db5ed03217b commit it
shows $system rather than the share path even to superusers. The GUC is
also GUC_SUPERUSER_ONLY. But any role can SET client_min_messages = debug3
and see every directory, including the real share path. As an ordinary role
(without pg_read_all_settings):

SHOW extension_control_path;
ERROR: permission denied to examine "extension_control_path"

SET client_min_messages = debug3;
SELECT count(*) FROM pg_available_extensions;
DEBUG: get_extension_control_directories: path "/opt/ext/extension"
DEBUG: get_extension_control_directories: path
"/usr/local/pgsql/share/extension"

find_in_path() has a similar DEBUG3 for dynamic_library_path, but
non-superusers rarely reach it, whereas here any query on the views does. I
would drop the elog.

2. In the original extension_control_path commit (4f7f7b03758), CREATE
EXTENSION searched with find_in_path(), which errors out when the search
reaches an empty element ("zero-length component in parameter", or "is not
an absolute path" for a trailing one). Commit 81eaaa2c41d replaced that
with find_in_paths(), which kept only the absolute-path check, and the same
commit's "%s/extension" suffix is what turns an empty element into
/extension. Rather than skipping silently, I would rather report the
mistake, at least on master. The check would have to go in
get_extension_control_directories() (or a check hook), since
find_in_paths() only sees the resulting "/extension" and can't tell it from
"/". That would also make the views and CREATE EXTENSION agree, which they
haven't since 4f7f7b03758; otherwise ':' silently lists nothing while ''
means $system. It is a behaviour change, though, the views, and
extension_file_exists() (used for the CREATE FUNCTION unknown-language
hint), would then error out on such a setting, so a silent skip may be the
better fit for back branches.

3. As superuser, a relative element is shown by pg_available_extensions
(resolved against the data directory), but CREATE EXTENSION rejects it in
find_in_paths() once the search reaches it:

SET extension_control_path = '$system:rel';
SELECT name, location FROM pg_available_extensions WHERE name =
'relext';
name | location
--------+---------------
relext | rel/extension

CREATE EXTENSION relext;
ERROR: component in parameter "extension_control_path" is not an
absolute path

The same place as in (2) could reject both.

4. I'm not convinced 0002 is needed. The saving is one readdir() per
repeated element in the views, for a setting I don't expect to be common.
The location checks in the new tests already pass on master, because the
views deduplicate by extension name.

Regards,
Surya Poondla

#4Chao Li
li.evan.chao@gmail.com
In reply to: surya poondla (#3)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 8, 2026, at 12:37, surya poondla <suryapoondla4@gmail.com> wrote:

Hi Chao,

I tested v1 on 0607aa61090, and did some extra code reading for this. A few comments:

Thank you very much for the review.

1. The new DEBUG3 message exposes the expanded paths to non-superusers. Since f3c9e341cdf commit, pg_available_extensions shows <insufficient privilege> as the location to them, and since your db5ed03217b commit it shows $system rather than the share path even to superusers. The GUC is also GUC_SUPERUSER_ONLY. But any role can SET client_min_messages = debug3 and see every directory, including the real share path. As an ordinary role (without pg_read_all_settings):

SHOW extension_control_path;
ERROR: permission denied to examine "extension_control_path"

SET client_min_messages = debug3;
SELECT count(*) FROM pg_available_extensions;
DEBUG: get_extension_control_directories: path "/opt/ext/extension"
DEBUG: get_extension_control_directories: path "/usr/local/pgsql/share/extension"

find_in_path() has a similar DEBUG3 for dynamic_library_path, but non-superusers rarely reach it, whereas here any query on the views does. I would drop the elog.

Ah, good catch. I actually reviewed f3c9e341cdf, but I had completely forgotten about that patch.

2. In the original extension_control_path commit (4f7f7b03758), CREATE EXTENSION searched with find_in_path(), which errors out when the search reaches an empty element ("zero-length component in parameter", or "is not an absolute path" for a trailing one). Commit 81eaaa2c41d replaced that with find_in_paths(), which kept only the absolute-path check, and the same commit's "%s/extension" suffix is what turns an empty element into /extension. Rather than skipping silently, I would rather report the mistake, at least on master. The check would have to go in get_extension_control_directories() (or a check hook), since find_in_paths() only sees the resulting "/extension" and can't tell it from "/". That would also make the views and CREATE EXTENSION agree, which they haven't since 4f7f7b03758; otherwise ':' silently lists nothing while '' means $system. It is a behaviour change, though, the views, and extension_file_exists() (used for the CREATE FUNCTION unknown-language hint), would then error out on such a setting, so a silent skip may be the better fit for back branches.

I’m okay with raising an error for empty path elements. That would let us remove the DEBUG3 logging and resolve point 1 as well. I added the logging mainly for testing purposes.

My feeling is that this patch might not need to be back-patched.

3. As superuser, a relative element is shown by pg_available_extensions (resolved against the data directory), but CREATE EXTENSION rejects it in find_in_paths() once the search reaches it:

SET extension_control_path = '$system:rel';
SELECT name, location FROM pg_available_extensions WHERE name = 'relext';
name | location
--------+---------------
relext | rel/extension

CREATE EXTENSION relext;
ERROR: component in parameter "extension_control_path" is not an absolute path

The same place as in (2) could reject both.

Thanks for reporting that. I hadn’t noticed the problem. As this is a separate issue, I put the fix in 0002.

4. I'm not convinced 0002 is needed. The saving is one readdir() per repeated element in the views, for a setting I don't expect to be common. The location checks in the new tests already pass on master, because the views deduplicate by extension name.

As I mentioned in the original patch email, this change is of relatively low value, but I think it’s also harmless. For example, if an extension directory is on network storage, avoiding a duplicate directory scan would be preferable. So I’d leave it as 0003 for now and wait for more opinions.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254536_4
v2-0001-Reject-empty-elements-in-extension_control_path.patchapplication/octet-stream; name=v2-0001-Reject-empty-elements-in-extension_control_path.patch; x-unix-mode=0644Download+27-2
v2-0002-Reject-relative-paths-consistently-in-extension_c.patchapplication/octet-stream; name=v2-0002-Reject-relative-paths-consistently-in-extension_c.patch; x-unix-mode=0644Download+24-6
v2-0003-Deduplicate-extension-control-search-directories.patchapplication/octet-stream; name=v2-0003-Deduplicate-extension-control-search-directories.patch; x-unix-mode=0644Download+53-13
#5Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Chao Li (#4)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi,

Thanks for sharing the bug and the patch!

I tested v2 and the 0001 and 0002 tests fail on master and pass with the
patches. With '$system:', ':$system', ':' and '$system:rel' both the
views and CREATE EXTENSION now report the same error, and '' still means
$system.

I have some comments:

1: The error is only raised when the path is used

Since the check is done in get_extension_control_directories(), an
invalid value is accepted without any complaint and the error only
shows up later, on whatever happens to read the path:

ALTER SYSTEM SET extension_control_path = '$system:';
SELECT pg_reload_conf();

-- later, on any session and with any role
SELECT count(*) FROM pg_available_extensions;
ERROR: empty element in parameter "extension_control_path"

This matches dynamic_library_path, which also accepts an empty element
on SET/ALTER SYSTEM and only complains when a library is loaded, so I'm
fine with it. A check hook could reject the value earlier, but an
invalid value already on postgresql.conf would then prevent the server
from starting, so I don't think it's worth it.

However, there is one case that is specific to extension_control_path.
It breaks CREATE FUNCTION and DO with a language that doesn't exist,
because extension_file_exists() is called to build the hint of the
"language does not exist" error, so the error from the path replaces the
original one:

SET extension_control_path = '$system:';
CREATE FUNCTION f() RETURNS int LANGUAGE nosuchlang AS 'x';
ERROR: empty element in parameter "extension_control_path"

while on master the same command reports:

ERROR: language "nosuchlang" does not exist

I think that extension_file_exists() should not replace the original
error here, since it's only used to decide whether to add a hint.

2: Error message on 0001

dfmgr.c already has "zero-length component in parameter \"%s\"" for
dynamic_library_path. Before 81eaaa2c41d, when CREATE EXTENSION still
used find_in_path(), that was the error for a leading or repeated
separator (a trailing one got "is not an absolute path" instead). Maybe
we can reuse it for all the empty element cases? It would keep both
parameters consistent and avoid a new error message.

3: Behaviour change on 0001 and 0002

A setting with a trailing separator, like '$system:', works on master,
since /extension usually doesn't exist and is just skipped. With 0001 it
becomes an error on every extension lookup. The same happens with 0002
for a relative element after a directory that already contains the
extension, which is the case covered by the new test. I think that's the
right behaviour, but since it can break a setting that works today on
18, I'm wondering how the backpatching would work on this case. This
behavior that you shared on this thread doesn't seems right to me, but
fixing only on master doesn't seens enough to me since we will have
difference behaviours across the versions.

4: find_in_paths() cleanup on 0002

With 0002 every location is canonicalized and checked to be absolute
when the list is built, so the pstrdup(), canonicalize_path() and
pfree() calls in find_in_paths() are redundant, and the loop could use
location->loc directly. Also, unrelated to this patch, find_in_paths()
is not static and has a local prototype on extension.c, although it's
only used there. Since we are touching this code, maybe it's worth
making it static too.

About 0003, I don't think it's needed. I think that listing the same
directory more than once is a user mistake, and the result is still
correct, since the views deduplicate by extension name and CREATE
EXTENSION uses the first match. I don't think we should add code to work
around this kind of mistake.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#6Chao Li
li.evan.chao@gmail.com
In reply to: Matheus Alcantara (#5)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 10, 2026, at 04:03, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

Hi,

Thanks for sharing the bug and the patch!

Thank you very much for the review.

I tested v2 and the 0001 and 0002 tests fail on master and pass with the
patches. With '$system:', ':$system', ':' and '$system:rel' both the
views and CREATE EXTENSION now report the same error, and '' still means
$system.

I have some comments:

1: The error is only raised when the path is used

Since the check is done in get_extension_control_directories(), an
invalid value is accepted without any complaint and the error only
shows up later, on whatever happens to read the path:

ALTER SYSTEM SET extension_control_path = '$system:';
SELECT pg_reload_conf();

-- later, on any session and with any role
SELECT count(*) FROM pg_available_extensions;
ERROR: empty element in parameter "extension_control_path"

This matches dynamic_library_path, which also accepts an empty element
on SET/ALTER SYSTEM and only complains when a library is loaded, so I'm
fine with it. A check hook could reject the value earlier, but an
invalid value already on postgresql.conf would then prevent the server
from starting, so I don't think it's worth it.

However, there is one case that is specific to extension_control_path.
It breaks CREATE FUNCTION and DO with a language that doesn't exist,
because extension_file_exists() is called to build the hint of the
"language does not exist" error, so the error from the path replaces the
original one:

SET extension_control_path = '$system:';
CREATE FUNCTION f() RETURNS int LANGUAGE nosuchlang AS 'x';
ERROR: empty element in parameter "extension_control_path"

while on master the same command reports:

ERROR: language "nosuchlang" does not exist

I think that extension_file_exists() should not replace the original
error here, since it's only used to decide whether to add a hint.

Thanks for pointing out this use case. In v3-0001, I added a bool parameter, skip_invalid_path, to get_extension_control_directories(), so that extension_file_exists() can skip empty and relative path elements and preserve the original unknown-language error and any applicable hint. I also added a new test to 0001 based on your example.

2: Error message on 0001

dfmgr.c already has "zero-length component in parameter \"%s\"" for
dynamic_library_path. Before 81eaaa2c41d, when CREATE EXTENSION still
used find_in_path(), that was the error for a leading or repeated
separator (a trailing one got "is not an absolute path" instead). Maybe
we can reuse it for all the empty element cases? It would keep both
parameters consistent and avoid a new error message.

Updated the error message in v3-0001.

3: Behaviour change on 0001 and 0002

A setting with a trailing separator, like '$system:', works on master,
since /extension usually doesn't exist and is just skipped. With 0001 it
becomes an error on every extension lookup. The same happens with 0002
for a relative element after a directory that already contains the
extension, which is the case covered by the new test. I think that's the
right behaviour, but since it can break a setting that works today on
18, I'm wondering how the backpatching would work on this case. This
behavior that you shared on this thread doesn't seems right to me, but
fixing only on master doesn't seens enough to me since we will have
difference behaviours across the versions.

I chose to silently discard empty path elements in v1 precisely with back-patching in mind. But I also thought Surya’s suggestion to raise an error for empty path elements was reasonable, so I changed the behavior in v2. As I mentioned in my earlier email, my feeling is that this behavior change doesn’t need to be back-patched.

If committers decide to back-patch, perhaps we could silently discard empty path elements on released branches? In that case, I can help prepare the back-patches.

4: find_in_paths() cleanup on 0002

With 0002 every location is canonicalized and checked to be absolute
when the list is built, so the pstrdup(), canonicalize_path() and
pfree() calls in find_in_paths() are redundant, and the loop could use
location->loc directly.

In v2, find_in_paths() still calls canonicalize_path() because system_dir has not been canonicalized in get_extension_control_directories(). Although get_share_path() canonicalizes sharepath, if sharepath is the root directory (/), psprintf("%s/extension", sharepath) introduces a duplicate slash, so system_dir still needs to be canonicalized.

I’ve now made find_in_paths() static and added canonicalization of system_dir to get_extension_control_directories(), allowing us to remove the redundant string operations from find_in_paths(). Done in v3-0001.

Also, unrelated to this patch, find_in_paths()
is not static and has a local prototype on extension.c, although it's
only used there. Since we are touching this code, maybe it's worth
making it static too.

Made find_in_paths() static in v3-0002.

About 0003, I don't think it's needed. I think that listing the same
directory more than once is a user mistake, and the result is still
correct, since the views deduplicate by extension name and CREATE
EXTENSION uses the first match. I don't think we should add code to work
around this kind of mistake.

As two reviewers considered 0003 is not necessary, let me drop it for now.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254536_6
v3-0001-Reject-empty-elements-in-extension_control_path.patchapplication/octet-stream; name=v3-0001-Reject-empty-elements-in-extension_control_path.patch; x-unix-mode=0644Download+75-27
v3-0002-Reject-relative-paths-consistently-in-extension_c.patchapplication/octet-stream; name=v3-0002-Reject-relative-paths-consistently-in-extension_c.patch; x-unix-mode=0644Download+68-31
#7Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Chao Li (#6)
Re: extension_control_path: ignore empty elements and deduplicate directories

Thanks for the new version!

I tested v3 and all the previous comments are addressed. CREATE FUNCTION
and DO with an unknown language now report the original error with
'$system:', ':' and '$system:rel', and the hint is still shown when a
remaining directory contains the extension.

Regarding the backpatch, I don't think that having a different behaviour
on master and on the back branches is a good idea. If '$system:' raises
an error on 20 but is silently ignored on 18 and 19, the same setting
behaves differently depending on the version, which seems confusing to
me, especially for a parameter that was only introduced on 18. I think
that we should either raise the error on all branches or silently ignore
the empty elements on all branches, and then backpatch whichever we
choose. (CCing Peter so we can get a committer thought on this).

This is also related to the "directory" documentation thread [1]/messages/by-id/CABkiuWpGiLzDg4D8zRBJ6DHnwYgHqkFxz2gDstXgeOdzh6bdZQ@mail.gmail.com that
you previously mention, where the '$system/foo' case came up.
Mahendrakar noticed there that with '$system/foo:$system'
pg_available_extensions lists the extensions from $system, while CREATE
EXTENSION fails on any of them, and asked whether a check hook to reject
such elements at SET time would be worth pursuing. With v3-0002 both now
fail consistently:

SET extension_control_path = '$system/foo:$system';
SELECT count(*) FROM pg_available_extensions;
ERROR: component in parameter "extension_control_path" is not an absolute path

So the inconsistency seems to be fixed here. But his concern about the
check hook also applies to 0002: a value like '$system:$system/foo'
works today for any extension found in $system, and with 0002 it fails
on every extension lookup. The only difference with a check hook would
be that the error shows up when the value is set (or when the server
starts) instead of when the path is used. So I think that whatever we
decide for the backpatch should also cover 0002.

Some small comments on v3:

1: On 0002, the location is allocated before the absolute path check,
so the skip branch needs to free it again. Since location->macro is
only set for $system, which always expands to an absolute path, the
pfree(location->macro) can't be reached. Maybe we could build and check
the mangled path first and only allocate the location when the element
is kept?

2: The USE_ASSERT_CHECKING block on find_in_paths() seems a bit too
much to me. Now that it's static and only used with the output of
get_extension_control_directories(), I think that
Assert(is_absolute_path(path)) and the header comment are enough.

3: The 0002 commit message still only mentions replacing the check in
find_in_paths() with an assertion. It would be good to also mention
that find_in_paths() is now static, that system_dir is canonicalized,
and that skip_invalid_path now also skips relative elements.

[1]: /messages/by-id/CABkiuWpGiLzDg4D8zRBJ6DHnwYgHqkFxz2gDstXgeOdzh6bdZQ@mail.gmail.com

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#8Chao Li
li.evan.chao@gmail.com
In reply to: Matheus Alcantara (#7)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 11, 2026, at 03:27, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

Thanks for the new version!

I tested v3 and all the previous comments are addressed. CREATE FUNCTION
and DO with an unknown language now report the original error with
'$system:', ':' and '$system:rel', and the hint is still shown when a
remaining directory contains the extension.

Regarding the backpatch, I don't think that having a different behaviour
on master and on the back branches is a good idea. If '$system:' raises
an error on 20 but is silently ignored on 18 and 19, the same setting
behaves differently depending on the version, which seems confusing to
me, especially for a parameter that was only introduced on 18. I think
that we should either raise the error on all branches or silently ignore
the empty elements on all branches, and then backpatch whichever we
choose. (CCing Peter so we can get a committer thought on this).

This is also related to the "directory" documentation thread [1] that
you previously mention, where the '$system/foo' case came up.
Mahendrakar noticed there that with '$system/foo:$system'
pg_available_extensions lists the extensions from $system, while CREATE
EXTENSION fails on any of them, and asked whether a check hook to reject
such elements at SET time would be worth pursuing. With v3-0002 both now
fail consistently:

SET extension_control_path = '$system/foo:$system';
SELECT count(*) FROM pg_available_extensions;
ERROR: component in parameter "extension_control_path" is not an absolute path

So the inconsistency seems to be fixed here. But his concern about the
check hook also applies to 0002: a value like '$system:$system/foo'
works today for any extension found in $system, and with 0002 it fails
on every extension lookup. The only difference with a check hook would
be that the error shows up when the value is set (or when the server
starts) instead of when the path is used. So I think that whatever we
decide for the backpatch should also cover 0002.

Some small comments on v3:

1: On 0002, the location is allocated before the absolute path check,
so the skip branch needs to free it again. Since location->macro is
only set for $system, which always expands to an absolute path, the
pfree(location->macro) can't be reached. Maybe we could build and check
the mangled path first and only allocate the location when the element
is kept?

Fixed in v4

2: The USE_ASSERT_CHECKING block on find_in_paths() seems a bit too
much to me. Now that it's static and only used with the output of
get_extension_control_directories(), I think that
Assert(is_absolute_path(path)) and the header comment are enough.

Removed that in v4.

3: The 0002 commit message still only mentions replacing the check in
find_in_paths() with an assertion. It would be good to also mention
that find_in_paths() is now static, that system_dir is canonicalized,
and that skip_invalid_path now also skips relative elements.

Updated 0002’s commit message in v4.

[1] /messages/by-id/CABkiuWpGiLzDg4D8zRBJ6DHnwYgHqkFxz2gDstXgeOdzh6bdZQ@mail.gmail.com

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

PFA v4:
* 0001 - unchanged from 0003
* 0002 - addressed Matheus’ review comments

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254536_8
v4-0001-Reject-empty-elements-in-extension_control_path.patchapplication/octet-stream; name=v4-0001-Reject-empty-elements-in-extension_control_path.patch; x-unix-mode=0644Download+75-27
v4-0002-Reject-relative-paths-consistently-in-extension_c.patchapplication/octet-stream; name=v4-0002-Reject-relative-paths-consistently-in-extension_c.patch; x-unix-mode=0644Download+63-40
#9Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Matheus Alcantara (#7)
Re: extension_control_path: ignore empty elements and deduplicate directories

On 10/11/26 16:27, Matheus Alcantara wrote:

Regarding the backpatch, I don't think that having a different behaviour
on master and on the back branches is a good idea. If '$system:' raises
an error on 20 but is silently ignored on 18 and 19, the same setting
behaves differently depending on the version, which seems confusing to
me, especially for a parameter that was only introduced on 18. I think
that we should either raise the error on all branches or silently ignore
the empty elements on all branches, and then backpatch whichever we
choose. (CCing Peter so we can get a committer thought on this).

I talked with Peter off list and it seems that just silently ignore
the error is the better approach to take here.

We currently don't raise an error for non-existing paths so I think
that it's ok to just ignore non-applicable path elements.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#10Chao Li
li.evan.chao@gmail.com
In reply to: Matheus Alcantara (#9)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 12, 2026, at 02:54, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

On 10/11/26 16:27, Matheus Alcantara wrote:

Regarding the backpatch, I don't think that having a different behaviour
on master and on the back branches is a good idea. If '$system:' raises
an error on 20 but is silently ignored on 18 and 19, the same setting
behaves differently depending on the version, which seems confusing to
me, especially for a parameter that was only introduced on 18. I think
that we should either raise the error on all branches or silently ignore
the empty elements on all branches, and then backpatch whichever we
choose. (CCing Peter so we can get a committer thought on this).

I talked with Peter off list and it seems that just silently ignore
the error is the better approach to take here.

We currently don't raise an error for non-existing paths so I think
that it's ok to just ignore non-applicable path elements.

Hi Matheus,

Thank you so much for discussing this with Peter and bringing the message back.

For 0001, we can revert to v1’s approach and silently discard empty path elements from extension_control_path.

One thing to note is that a completely empty extension_control_path ('') will still be interpreted as $system, preserving the existing behavior. A value containing only separators, such as ':', will provide no search directories, so no extensions will be found.

For 0002, I revisited the example Surya provided:
```
SET extension_control_path = '$system:rel';
SELECT name, location FROM pg_available_extensions WHERE name = 'relext';
name | location
--------+---------------
relext | rel/extension

CREATE EXTENSION relext;
ERROR: component in parameter "extension_control_path" is not an absolute path
```

I think the key problem is that pg_available_extensions lists extensions found through relative paths, but CREATE EXTENSION fails when it reaches a relative path, before searching that directory.

So I think we can also silently discard relative path elements. In the example above, pg_available_extensions will return no row for relext, and CREATE EXTENSION will fail with extension "relext" is not available, assuming relext is available only through rel. This approach also eliminates the inconsistency.

This introduces a behavior change for CREATE EXTENSION. For example, with extension_control_path = '/path1:relative:/path2', CREATE EXTENSION currently fails if the search reaches 'relative'. With v5-0002, it will skip that element and proceed if the extension is found in /path2; otherwise, it will report that the extension is not available. I think that should be fine.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t254536_10
v5-0001-Ignore-empty-elements-in-extension_control_path.patchapplication/octet-stream; name=v5-0001-Ignore-empty-elements-in-extension_control_path.patch; x-unix-mode=0644Download+68-25
v5-0002-Ignore-relative-elements-in-extension_control_pat.patchapplication/octet-stream; name=v5-0002-Ignore-relative-elements-in-extension_control_pat.patch; x-unix-mode=0644Download+82-40
#11Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Chao Li (#10)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Thu Nov 12, 2026 at 12:05 AM -03, Chao Li wrote:

Hi Matheus,

Thank you so much for discussing this with Peter and bringing the
message back.

For 0001, we can revert to v1’s approach and silently discard empty
path elements from extension_control_path.

One thing to note is that a completely empty extension_control_path
('') will still be interpreted as $system, preserving the existing
behavior. A value containing only separators, such as ':', will
provide no search directories, so no extensions will be found.

For 0002, I revisited the example Surya provided:
```
SET extension_control_path = '$system:rel';
SELECT name, location FROM pg_available_extensions WHERE name = 'relext';
name | location
--------+---------------
relext | rel/extension

CREATE EXTENSION relext;
ERROR: component in parameter "extension_control_path" is not an absolute path
```

I think the key problem is that pg_available_extensions lists
extensions found through relative paths, but CREATE EXTENSION fails
when it reaches a relative path, before searching that directory.

So I think we can also silently discard relative path elements. In the
example above, pg_available_extensions will return no row for relext,
and CREATE EXTENSION will fail with extension "relext" is not
available, assuming relext is available only through rel. This
approach also eliminates the inconsistency.

This introduces a behavior change for CREATE EXTENSION. For example,
with extension_control_path = '/path1:relative:/path2', CREATE
EXTENSION currently fails if the search reaches 'relative'. With
v5-0002, it will skip that element and proceed if the extension is
found in /path2; otherwise, it will report that the extension is not
available. I think that should be fine.

Thanks for the new version!

I tested v5 on master and REL_19_STABLE, where it applies cleanly and
the TAP tests pass. With '$system:', ':$system', '$system:rel',
'rel:$system' and '$system/foo:$system', pg_available_extensions,
CREATE EXTENSION and the unknown-language hint now behave the same, and
'' still means $system.

Just a note about the 0001 tests: they also pass on master without the
patch. On master an empty element is expanded to /extension, which
usually doesn't exist, so it's just skipped and the extension is still
found on the remaining directories. The difference is only visible if
/extension exists, which we can't create on a TAP test, so I don't think
that there is anything we can do here, but the tests are still useful to
prevent regressions. The 0002 tests fail on master as expected.

v5 doesn't apply on REL_18_STABLE, since get_extension_control_directories()
there returns a List of plain char * paths instead of ExtensionLocation,
and pg_available_extensions doesn't have the location column. The
attached patches are a backport of v5 to REL_18_STABLE. The changes are:

- The empty and relative element checks are the same, but applied to
the List of char * paths, using the "$system" string directly since
there is no EXTENSION_SYSTEM_MACRO on 18.
- find_in_paths() is made static and simplified in the same way.
- The tests that check the location column were changed to check
whether the extension is listed with count(*), and use $ext_dir since
$ext_dir_canonicalized doesn't exist on the 18 test.

The patches have the .nocfbot suffix so they don't break the CFBot.

I'm attaching as v6, but 0001 and 0002 are unchanged.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

Attachments:

t254536_11
v6-0001-Ignore-empty-elements-in-extension_control_path.patchtext/plain; charset=utf-8; name=v6-0001-Ignore-empty-elements-in-extension_control_path.patchDownload+68-25
v6-0002-Ignore-relative-elements-in-extension_control_pat.patchtext/plain; charset=utf-8; name=v6-0002-Ignore-relative-elements-in-extension_control_pat.patchDownload+82-40
v6-REL-18-0001-Ignore-empty-elements-in-extension_control_path.patch.nocfbottext/plain; charset=utf-8; name=v6-REL-18-0001-Ignore-empty-elements-in-extension_control_path.patch.nocfbotDownload+58-17
v6-REL-18-0002-Ignore-relative-elements-in-extension_control_path.patch.nocfbottext/plain; charset=utf-8; name=v6-REL-18-0002-Ignore-relative-elements-in-extension_control_path.patch.nocfbotDownload+69-33
#12Chao Li
li.evan.chao@gmail.com
In reply to: Matheus Alcantara (#11)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 13, 2026, at 21:26, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

On Thu Nov 12, 2026 at 12:05 AM -03, Chao Li wrote:

Hi Matheus,

Thank you so much for discussing this with Peter and bringing the
message back.

For 0001, we can revert to v1’s approach and silently discard empty
path elements from extension_control_path.

One thing to note is that a completely empty extension_control_path
('') will still be interpreted as $system, preserving the existing
behavior. A value containing only separators, such as ':', will
provide no search directories, so no extensions will be found.

For 0002, I revisited the example Surya provided:
```
SET extension_control_path = '$system:rel';
SELECT name, location FROM pg_available_extensions WHERE name = 'relext';
name | location
--------+---------------
relext | rel/extension

CREATE EXTENSION relext;
ERROR: component in parameter "extension_control_path" is not an absolute path
```

I think the key problem is that pg_available_extensions lists
extensions found through relative paths, but CREATE EXTENSION fails
when it reaches a relative path, before searching that directory.

So I think we can also silently discard relative path elements. In the
example above, pg_available_extensions will return no row for relext,
and CREATE EXTENSION will fail with extension "relext" is not
available, assuming relext is available only through rel. This
approach also eliminates the inconsistency.

This introduces a behavior change for CREATE EXTENSION. For example,
with extension_control_path = '/path1:relative:/path2', CREATE
EXTENSION currently fails if the search reaches 'relative'. With
v5-0002, it will skip that element and proceed if the extension is
found in /path2; otherwise, it will report that the extension is not
available. I think that should be fine.

Thanks for the new version!

Thanks a lot for your continuous review and testing work.

I tested v5 on master and REL_19_STABLE, where it applies cleanly and
the TAP tests pass. With '$system:', ':$system', '$system:rel',
'rel:$system' and '$system/foo:$system', pg_available_extensions,
CREATE EXTENSION and the unknown-language hint now behave the same, and
'' still means $system.

Just a note about the 0001 tests: they also pass on master without the
patch. On master an empty element is expanded to /extension, which
usually doesn't exist, so it's just skipped and the extension is still
found on the remaining directories. The difference is only visible if
/extension exists, which we can't create on a TAP test, so I don't think
that there is anything we can do here, but the tests are still useful to
prevent regressions.

Yes, we cannot create an extension under /extension in the TAP tests. In v1, I added DEBUG3 messages to show the paths being searched, so the test could verify whether /extension was searched. I later removed those messages because they could expose system paths to non-superusers. Now the test only verifies that empty path elements do not prevent searching the remaining directories, so it also passes on master.

The 0002 tests fail on master as expected.

v5 doesn't apply on REL_18_STABLE, since get_extension_control_directories()
there returns a List of plain char * paths instead of ExtensionLocation,
and pg_available_extensions doesn't have the location column. The
attached patches are a backport of v5 to REL_18_STABLE. The changes are:

- The empty and relative element checks are the same, but applied to
the List of char * paths, using the "$system" string directly since
there is no EXTENSION_SYSTEM_MACRO on 18.
- find_in_paths() is made static and simplified in the same way.
- The tests that check the location column were changed to check
whether the extension is listed with count(*), and use $ext_dir since
$ext_dir_canonicalized doesn't exist on the 18 test.

The patches have the .nocfbot suffix so they don't break the CFBot.

I'm attaching as v6, but 0001 and 0002 are unchanged.

Thanks for preparing for the patch file for v18.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com
<v6-0001-Ignore-empty-elements-in-extension_control_path.patch><v6-0002-Ignore-relative-elements-in-extension_control_pat.patch><v6-REL-18-0001-Ignore-empty-elements-in-extension_control_path.patch.nocfbot><v6-REL-18-0002-Ignore-relative-elements-in-extension_control_path.patch.nocfbot>

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

#13Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Chao Li (#12)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Sun Nov 15, 2026 at 10:44 PM -03, Chao Li wrote:

Just a note about the 0001 tests: they also pass on master without the
patch. On master an empty element is expanded to /extension, which
usually doesn't exist, so it's just skipped and the extension is still
found on the remaining directories. The difference is only visible if
/extension exists, which we can't create on a TAP test, so I don't think
that there is anything we can do here, but the tests are still useful to
prevent regressions.

Yes, we cannot create an extension under /extension in the TAP tests.
In v1, I added DEBUG3 messages to show the paths being searched, so
the test could verify whether /extension was searched. I later removed
those messages because they could expose system paths to
non-superusers. Now the test only verifies that empty path elements do
not prevent searching the remaining directories, so it also passes on
master.

Yeah, I'm not sure if we can do better here. But I think that the test
is still worth.

Thanks for preparing for the patch file for v18.

It seems to me that the patch don't have any more comments, so I'll mark
the CF entry as Ready for Committer. Additional comments are always
welcome.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#14Andres Freund
andres@anarazel.de
In reply to: Chao Li (#1)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi,

On 2026-11-03 13:21:17 +0800, Chao Li wrote:

1. Empty path elements are silently interpreted as "/extension"

Say a user sets extension_control_path = '$system:', it will be interpreted as two paths: $system and an empty string, and the empty string will be expanded to "/extension". Since "/extension" is an absolute path, it will be searched for extensions. If the host machine doesn't have "/extension", the path will be silently ignored; but if the directory happens to exist, it will be searched for extensions, which doesn't sound desirable, because the user might not be aware of that at all.

Adding a trailing colon is an easy mistake to make, but silently searching "/extension" is unintended behavior. So I think we should silently discard empty path elements. An entirely empty string ('') is interpreted as $system as documented, and that behavior should be retained.

I don't like silently ignoring user mistakes. Either we should make it an
error or accept it. Which user would be served by silently reinterpreting
what they might have meant?

2. It may read the same directory more than once

Say a user sets extension_control_path = '$system:$system', that's an
obvious duplicate path, but the current implementation will scan $system
twice when listing available extensions, and only deduplicate extension
names later.

There is no correctness problem here, but deduplicating search paths may
avoid unnecessary directory reads. I think this is a relatively low-priority
but useful optimization.

Don't do that then. It's not like this is anywhere near performance relevant
paths.

Greetings,

Andres Freund

#15Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Andres Freund (#14)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi Andres,

On Mon Nov 16, 2026 at 12:10 PM -03, Andres Freund wrote:

Hi,

On 2026-11-03 13:21:17 +0800, Chao Li wrote:

1. Empty path elements are silently interpreted as "/extension"

Say a user sets extension_control_path = '$system:', it will be interpreted as two paths: $system and an empty string, and the empty string will be expanded to "/extension". Since "/extension" is an absolute path, it will be searched for extensions. If the host machine doesn't have "/extension", the path will be silently ignored; but if the directory happens to exist, it will be searched for extensions, which doesn't sound desirable, because the user might not be aware of that at all.

Adding a trailing colon is an easy mistake to make, but silently searching "/extension" is unintended behavior. So I think we should silently discard empty path elements. An entirely empty string ('') is interpreted as $system as documented, and that behavior should be retained.

I don't like silently ignoring user mistakes. Either we should make it an
error or accept it. Which user would be served by silently reinterpreting
what they might have meant?

The idea on v6 is that it just discard empty path elements. It doesn't
mean that the path element will be reinterpreted. So if an user set
extension_control_path = '$system:' just $system will be used.

We already ignore paths that does not exists, so the idea was to follow
the same behavior.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#16Andres Freund
andres@anarazel.de
In reply to: Matheus Alcantara (#15)
Re: extension_control_path: ignore empty elements and deduplicate directories

Hi,

On 2026-11-16 13:20:41 -0300, Matheus Alcantara wrote:

On Mon Nov 16, 2026 at 12:10 PM -03, Andres Freund wrote:

I don't like silently ignoring user mistakes. Either we should make it an
error or accept it. Which user would be served by silently reinterpreting
what they might have meant?

The idea on v6 is that it just discard empty path elements. It doesn't
mean that the path element will be reinterpreted. So if an user set
extension_control_path = '$system:' just $system will be used.

We already ignore paths that does not exists, so the idea was to follow
the same behavior.

I don't think that's the same. A non-existing extension dir could make sense,
e.g. to allow installing extensions from container overlays. And it's not
ignoring the users intent to ignore it, since there obviously aren't
extensions in there. What's the argument for ignoring empty path elements
instead of erroring out?

Greetings,

Andres Freund

#17Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Andres Freund (#16)
Re: extension_control_path: ignore empty elements and deduplicate directories

On 16/11/26 13:26, Andres Freund wrote:

Hi,

On 2026-11-16 13:20:41 -0300, Matheus Alcantara wrote:

On Mon Nov 16, 2026 at 12:10 PM -03, Andres Freund wrote:

I don't like silently ignoring user mistakes. Either we should make it an
error or accept it. Which user would be served by silently reinterpreting
what they might have meant?

The idea on v6 is that it just discard empty path elements. It doesn't
mean that the path element will be reinterpreted. So if an user set
extension_control_path = '$system:' just $system will be used.

We already ignore paths that does not exists, so the idea was to follow
the same behavior.

I don't think that's the same. A non-existing extension dir could make sense,
e.g. to allow installing extensions from container overlays. And it's not
ignoring the users intent to ignore it, since there obviously aren't
extensions in there. What's the argument for ignoring empty path elements
instead of erroring out?

I think that is mostly for back-patching. Turning into an error would
make a server to not start after a minor release upgrade. Querying
pg_available_extensions would also break after the upgrade with an
empty path element.

Ideally I also think that raising an error would be better, but this
back-patching issue got me, and having different behaviors across
different versions also seems confusing to me, but I might being to
conservative here.

(Thinking while writing this, and not being too conservative, perhaps
we can consider to ignore empty path elements for back-patching and
change master to raise an error since the with extension_control_path
= '$system:' is an invalid syntax.).

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#18Chao Li
li.evan.chao@gmail.com
In reply to: Matheus Alcantara (#17)
Re: extension_control_path: ignore empty elements and deduplicate directories

On Nov 17, 2026, at 00:40, Matheus Alcantara <matheusssilv97@gmail.com> wrote:

On 16/11/26 13:26, Andres Freund wrote:

Hi,
On 2026-11-16 13:20:41 -0300, Matheus Alcantara wrote:

On Mon Nov 16, 2026 at 12:10 PM -03, Andres Freund wrote:

I don't like silently ignoring user mistakes. Either we should make it an
error or accept it. Which user would be served by silently reinterpreting
what they might have meant?

The idea on v6 is that it just discard empty path elements. It doesn't
mean that the path element will be reinterpreted. So if an user set
extension_control_path = '$system:' just $system will be used.

We already ignore paths that does not exists, so the idea was to follow
the same behavior.

I don't think that's the same. A non-existing extension dir could make sense,
e.g. to allow installing extensions from container overlays. And it's not
ignoring the users intent to ignore it, since there obviously aren't
extensions in there. What's the argument for ignoring empty path elements
instead of erroring out?

I think that is mostly for back-patching. Turning into an error would
make a server to not start after a minor release upgrade. Querying
pg_available_extensions would also break after the upgrade with an
empty path element.

Ideally I also think that raising an error would be better, but this
back-patching issue got me, and having different behaviors across
different versions also seems confusing to me, but I might being to
conservative here.

(Thinking while writing this, and not being too conservative, perhaps we can consider to ignore empty path elements for back-patching and change master to raise an error since the with extension_control_path = '$system:' is an invalid syntax.).

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

V1 silently discarded empty path elements, v2/v3/v4 switched to raising an error, and v5/v6 changed back to silently discarding them.

Personally, I don’t have a strong preference for either approach. Silently discarding empty elements mainly benefits backward compatibility. When /extension doesn’t exist, it preserves the existing behavior; when /extension exists, it prevents an unintended search of that directory.

I also agree that rejecting empty path elements is reasonable. A similar case in PG is dynamic_library_path. find_in_path() in dfmgr.c also rejects empty elements. If we take this approach, the main compatibility question is whether to back-patch it. Back-patching could break extension lookups on an existing cluster whose extension_control_path happens to be defined as '/path_1:/path_2:'.

As I mentioned previously, I think applying the fix only to master is also an option.

One thing I want to add is that extension_control_path currently has no way to specify an empty search list to prevent installing additional extensions. An empty string ('') is interpreted as '$system'. A workaround is to specify an empty or nonexistent directory, such as '/foo', but that still searches /foo/extension and depends on what exists there. With v6, ':' can represent an empty search list. However, I don’t see this as an argument for choosing the silent-discard approach. It's more of a separate feature. We could also provide the way to specify an empty search list while rejecting empty elements.

Since we haven’t reached an agreement yet, I’ll hold off on revising the patch for now and wait for more feedback.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/