-
-
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: improve fake pg_config in default output #341421
Conversation
To avoid the deprecation warning.
fcf27fe
to
cb6bbf2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good now, except for one remark.
Currently testing the change.
If no further issues arise during testing, we can merge as soon as this is fixed.
Thank you for your work!
cb6bbf2
to
d1da18d
Compare
d1da18d
to
9761c71
Compare
I'm not happy with the current implementation, yet. Two reasons:
|
9761c71
to
7783f3a
Compare
Ok, the latest version is one that I am quite happy with, it should check all the boxes. |
d67e3f2
to
09d6dc3
Compare
Except that the prevention of infinite recursion doesn't work as expected, yet. |
This fixes some build systems which look up the location of pg_config via the location of the postgres binary itself, e.g. timescaledb, instead of calling pg_config which is on PATH. Since the -dev output is correctly placed before the default output of postgresql in PATH, we can rely on that and call "pg_config" from the default output's fake script. Only do that, when the one on PATH is actually a different file, though, to prevent infinite loops. Resolves NixOS#341408
09d6dc3
to
0c47767
Compare
But now it does, after the latest push. |
@@ -0,0 +1,35 @@ | |||
# The real pg_config needs to be in the same path as the "postgres" binary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come there's no shebang here? (Just browsing by as this is blocking my VERY (not) important desktop upgrades where I'm not even using TimeScale yet 😄 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #341421 (comment), the shebang should be added by writeShellApplication
automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw I built this locally and tested all cases we came up with and covered before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ma27 No doubt it'd work. If there's no shebang it'll run in the executing shell. I was just curious why it's omitted.
I usually use writeScriptBin, stick a shebang in the file as
#! /usr/bin/env bash
then prepend a shebang in Nix with a specified version (second shebang is effectively ignored then). The reason being editor tooling reading the shebang to know what highlights and checks to apply.
Sorry I've been up all night and was just curious, call it bikeshedding2.0 in hindsight 😸
Thanks for the replies!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason being editor tooling reading the shebang to know what highlights and checks to apply.
I thought about that, too, and briefly wondered whether to add a # shellcheck shell=bash
directive to be able to run shellcheck directly on the file. But since writeShellApplication
includes shellchecking, I didn't see the need for that. My editor highlights correctly without the shebang, too.
But yeah, I can see this as a valid reason to do it.
pg_config is broken and it's bothersome to override because postgres packages(plugins) are their own package scope so we can't simply override some bullshit fix for timescale without overriding the entirety of our selected postgres version. Which doesn't really matter because we're enabling Python support in postgres and building it anyways, but it's not right!
Description of changes
This fixes some build systems which look up the location of pg_config via the location of the postgres binary itself, e.g. timescaledb, instead of calling pg_config which is on PATH.
Since the -dev output is correctly placed before the default output of postgresql in PATH, we can rely on that and call "pg_config" from the default output's fake script. Only do that, when the one on PATH is actually a different file, though, to prevent infinite loops.
@Ma27 could you have a look?
Resolves #341408, CC @zoechi
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.