Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9lLB-0062p6-TN for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Apr 2025 13:49:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u9lL9-007QgX-Fi for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Apr 2025 13:49:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9lL9-007QgD-4B for pgsql-hackers@lists.postgresql.org; Tue, 29 Apr 2025 13:49:40 +0000 Received: from mail-vk1-xa35.google.com ([2607:f8b0:4864:20::a35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u9lL7-000BYZ-2p for pgsql-hackers@lists.postgresql.org; Tue, 29 Apr 2025 13:49:38 +0000 Received: by mail-vk1-xa35.google.com with SMTP id 71dfb90a1353d-523f721bc63so7202414e0c.0 for ; Tue, 29 Apr 2025 06:49:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745934577; x=1746539377; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=q4PSKp4LAi+WA6LxhYxej5E6Ctf5zmCNl/kwxZqljnQ=; b=QUlkggOX139KefyOLkK+z74skF4VdpO94wl7wQIF0Jy5bXob2HbO/n3K8pRdihwR0s eqzQ1KvULgQpljnorgrBZuHy7DvukArFcIfHrb21Q8tcNqxsJAJUhNnRJhCEz5d8+sRg ZcPoDJKW1M6k/3oBl6MRTBNxlFNiwQt2FIzwMqxL+MkPxMZ3oBnb3V3KBaAGoWkKZvVQ 5lqvomtyL+q5XJdmI3r/P7uhPyOY66y3e4Mq39/FPZvCS9FoexsNmqjhKknDqYXLk2Bb f9SUKLeNYeW/vbKc0eiGy9JhuLB83z2iw1VbppDOfKtB1yaOqZooIY5YIGihnEfpH8+E j5dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745934577; x=1746539377; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q4PSKp4LAi+WA6LxhYxej5E6Ctf5zmCNl/kwxZqljnQ=; b=JPo2BGl4hI4I5Co5dyfoRH1m0wxIxmO/6MGyBOjXnzegBBV/EZUj0NyXB+uD2JlzHJ 3M4wv6KhFRq2j1eF6nFwyVeIg+ymAUdW4wF9pXZkESlnj8oO0H75si/qBchrCC7gTAY5 ywro2emhG0q9Y+Ff8ujlk5Pq1xd7sWZVGgZU1eTFJLNA0atJPpCDAf8Tcjr67P5GvfXJ j2jiDK7YMzU5Rbq1dquiFrpXE4gVy4RFmsJuWO4jP48JUwZ9zW0X2XAGp2IJq43HBRLT jfAIqNnOIlbpum35KroZRw6Oq0LfYArJhH1xhfvnIfJePY5oxhGz2VixrKfUK2Q8PD2N 2CTQ== X-Forwarded-Encrypted: i=1; AJvYcCVjDpsHHCFvoXw4PxgOcHTAzDWyyZaVAYrxFU8IrRtNq79qInVs9KjnkK8zWHFpZ/jcnGvySGNiyZpwoPLq@lists.postgresql.org X-Gm-Message-State: AOJu0YwOopp8u3UK6bbL+IzEDyWMqzuZTd1yDCef/l45lWo+RiytmEtc GCJCbLl+4IBkb2vo00/X/xokpTUVjKq7pRSvJ2ejakBHFk2wpvaY2Uj4rMb5aftPvoyFc2Fa68o +c7gQPscEMxXdnhWIciqxGEdgCAc= X-Gm-Gg: ASbGncuH8pCVyJdV16nufyWnWIF5mZb63q3cSNPHpEUbhCUnuTT4S+Sr4i94ZG22TxP I1SQesKfsPjNxbumeyJoMwyU0fbdXbaKYFAxPWZHamXC4MFCpihKFv48CR6G9kQ/zglCmU/Z3T5 QlP+G7AtfeOYM4OHkdvG812V7gXpdKpdQ+hUxorBd8wW2S3udqwztj+6o= X-Google-Smtp-Source: AGHT+IEgRje/IJ+NIxmkFQw1N93r9p9v8Be03nJgZugxsxPJvaoTwJZkiTmlNP+bH/2LK37GWJ0vuE890jBU6wkhcUk= X-Received: by 2002:a05:6122:884:b0:523:771e:8b81 with SMTP id 71dfb90a1353d-52abf80f793mr2061774e0c.7.1745934577142; Tue, 29 Apr 2025 06:49:37 -0700 (PDT) MIME-Version: 1.0 References: <3C304C9E-976C-4FB9-A883-707E0B90756A@justatheory.com> <546E7C54-D2F4-4DBB-9A06-EBBF90265A2C@justatheory.com> <672C8C5E-519A-4B39-9421-E6C31917B271@justatheory.com> In-Reply-To: From: Matheus Alcantara Date: Tue, 29 Apr 2025 10:49:09 -0300 X-Gm-Features: ATxdqUEenSrpRRCUFyJ7RhqMFv9v2bi-_XlvPd8vMKzxiq3tFSak9M0fJOXikto Message-ID: Subject: Re: extension_control_path and "directory" To: "David E. Wheeler" Cc: Christoph Berg , Peter Eisentraut , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 28, 2025 at 5:49=E2=80=AFPM David E. Wheeler wrote: > > > To append the /extension at each path on extension_control_path would > > require some changes on find_in_path() that > > find_extension_control_filename() calls, which I think that it would > > make the function more complicated. I've them created a similar > > find_in_paths() function that works in the same way but it receives a > > List of paths instead of the string of paths separated by ":". We can > > get this List of paths using get_extension_control_directories() that > > also handle the macro substitution like find_in_path(). > > > > Attached v4 with these fixes. I hope that now you should be able to omi= t > > the /extension from the GUC value. > > Yes! It now works with this configuration: > > ```ini > extension_control_path =3D '/Users/david/Downloads/share/postgresql:$syst= em' > dynamic_library_path =3D '/Users/david/Downloads/lib/postgresql:$libdir= =E2=80=99 > ``` > > Which is nicely more consistent. Kind of want that first one to be called= =E2=80=9Cshare_path=E2=80=9D now, though, since it=E2=80=99s not just exte= nsions. Although I guess it=E2=80=99s only extension control file searching= that uses it (for now). > Thanks for testing! > If I understand this bit correctly: > > ```c > /* Substitute the path macro if needed */ > mangled =3D substitute_path_macro(piece, "$system", system_dir); > > /* > * Append "extension" suffix in case is a custom extension control > * path. > */ > if (strcmp(piece, "$system") !=3D 0) > mangled =3D psprintf("%s/extension", mangled); > ``` > > The value of `piece` is a single path from the search path, right? If so,= I think it=E2=80=99s either `$system` or something else; I don=E2=80=99t i= t would ever be that `$system` is a substring of a single path. Is that rig= ht? > Yes, it is a single path from the search path, in your case it will be "/Users/david/Downloads/share/postgresql" and "$system". We split these paths based on the system path separator and get the next "piece" here: char *piece =3D first_path_var_separator(ecp); The first_path_var_separator() changes the "ecp" parameter on every call, it returns the next path on "ecp" and changes it to have the remaining paths to iterate over it. > Other than that, I think this patch is good to go. Thanks! > Thanks for reviewing! --=20 Matheus Alcantara