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