Re: Potential problem in commit f777d773878 and 4f7f7b03758

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Potential problem in commit f777d773878 and 4f7f7b03758
Date: 2025-08-22 11:02:34
Message-ID: CAFiTN-u_WW9Kd_jJxeG_GiWXEnh60X10QN6ORBsqrX32RiZmpw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 22, 2025 at 4:04 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> Simple test to reproduce:
>
> Change the module path for any extension as below, like I have done
> for amcheck and then copy the .so file at $libdir/test/ folder.
> module_pathname = '$libdir/test/amcheck'
>
> While creating the extension it fail to load the file because, after
> commit f777d773878 we remove the $libdir from the path[1] and later in
> expand_dynamic_library_name() since there is a '/' in remaining path
> we will call full = substitute_path_macro(name, "$libdir",
> pkglib_path); to generate the full path by substituting the "$libdir"
> macro[2]. But we have already removed $libdir from the filename, so
> there will be no substitution and it will just search the
> 'test/amcheck' path, which was not intended.
>
> IMHO the fix should be that we need to preserve the original name as
> well, and in the else case we should pass the original name which is
> '$libdir/test/amcheck' in this case so that macro substitution can
> work properly?
>

I just quickly changed this and it's working fine, but I haven't
analyzed fully whether it breaks something which was intended by the
commit (f777d773878 and 4f7f7b03758) but check-world is passing.

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
poc_fix.patch application/octet-stream 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message myzhen 2025-08-22 11:15:56 Improve cache hit rate for OprCacheHash
Previous Message Amit Kapila 2025-08-22 10:50:41 Re: [BUG?] check_exclusion_or_unique_constraint false negative