-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
postgresql: Fix use with extensions #17838
Conversation
@lancelotsix, thanks for your PR! By analyzing the annotation information on this pull request, we identified @MarcWeber, @edolstra and @aszlig to be potential reviewers |
55f2db1
to
67be11b
Compare
@vcunat could you have a look at that PR ? The problems mentioned above come from the moment where a `"lib" output have been introduced. postgres cannot find libdir and pkglibdir relative to its position. This search is done within this function: /*
* make_relative_path - make a path relative to the actual binary location
*
* This function exists to support relocation of installation trees.
*
* ret_path is the output area (must be of size MAXPGPATH)
* target_path is the compiled-in path to the directory we want to find
* bin_path is the compiled-in path to the directory of executables
* my_exec_path is the actual location of my executable
*
* We determine the common prefix of target_path and bin_path, then compare
* the remainder of bin_path to the last directory component(s) of
* my_exec_path. If they match, build the result as the part of my_exec_path
* preceding the match, joined to the remainder of target_path. If no match,
* return target_path as-is.
*
* For example:
* target_path = '/usr/local/share/postgresql'
* bin_path = '/usr/local/bin'
* my_exec_path = '/opt/pgsql/bin/postmaster'
* Given these inputs, the common prefix is '/usr/local/', the tail of
* bin_path is 'bin' which does match the last directory component of
* my_exec_path, so we would return '/opt/pgsql/share/postgresql'
*/ but since we split out and lib into 2 different outputs, Thanks |
Looking forward to this. I was holding off on a work project for now because I couldn't get extensions working :[ |
@lancelotsix did you verify that |
$ nix-build nixos/tests/postgresql.nix
/nix/store/5y3h5la10w0j44v1p0lwr8i2hhffqlps-vm-test-run-postgresql
$ nix-build nixos/tests/postgis.nix
/nix/store/mgj16drf58yk4ybbsgmnkp4vzhp9aqal-vm-test-run-postgresql |
If @vcunat doesn't have any objections, I'll merge this soonish. |
Fixes NixOS#15512 and NixOS#16032 With the multi output, postgresql cannot find at runtime what is its basedir when looking for libdir and pkglibdir. This commit fixes that.
I have just updated the |
OK with me. It would be nicer to hard-code the paths directly in the executables, but that might be complicated if they use the same path for things that we split now... |
I say OK but mean thanks! ;-) |
@domenkozar: do you count on this for 16.09 or not? |
Yes On Fri, Sep 2, 2016, 20:10 Vladimír Čunát notifications@github.com wrote:
|
(cherry picked from commit 02217bf)
Picked. |
@vcunat we cannot know what will be the final path at compilation time. postgres will have to load from the same path both its core libraries and extensions (such as postgis). The derivation containing all those files is not known until we go thru |
Ah, I see, external extensions... I did no detailed reading of this PR. |
(cherry picked from commit 02217bf)
Dynamic modules are technically libraries, but are not used by other packages. Instead they are loaded by PostgreSQL itself, e.g. as extensions. Those just increased the size of the lib output without benefit. This removes the NIX_PGLIBDIR hack introduced in #17838 and instead makes sure that pg_config always returns the correct PGLIBDIR. The test for postgis introduced in the same PR is still passing with the change.
Motivation for this change
Postgresql extension mechanism is broken in master as reported in #15512 and #16032
Things done
(nix.useChroot on NixOS,
or option
build-use-chroot
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)Fixes #15512 and #16032