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
glibc: Fix _CS_PATH to include default profile #94937
base: master
Are you sure you want to change the base?
Conversation
The string returned by confstr(_CS_PATH)[*1], which is also the output of the command 'getconf PATH'[*2], contains a default path that is guaranteed to find (at least) all POSIX standard utilities. The current value is: /run/current-system/sw/bin:/bin:/usr/bin There are two problems with this. 1. /bin and /usr/bin should be removed, as NixOS package management never puts anything there. Anything dropped in /bin or /usr/bin under the name of a standard utility would likely be bogus. 2. The default profile binaries directory is not in it. This is a problem because the default NixOS installation lacks several mandatory standard POSIX utilities. The command recommended by the system's error message for a missing command to install a missing package foo is 'nix-env -iA nixos.foo'. When this is done as root, the corresponding binaries are installed for all users in /nix/var/nix/profiles/default/bin. This commit fixes these problems as follows: pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch: - CS_PATH: Replace '/bin:/usr/bin' fallback by default profile path '/nix/var/nix/profiles/default/bin'. [*1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html [*2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/getconf.html Fixes: NixOS#65512
Could someone rerun the |
Ping @peti (who committed the original value). |
@ofborg eval |
I marked this as stale due to inactivity. → More info |
Again, still not stale. See #65512 |
I'm not sure if /bin and /usr/bin should be removed, due to /bin/sh and /usr/bin/env? |
/bin and /usr/bin are unused in NixOS. Those compatibility symlinks are for invoking /bin/sh and /usr/bin/env directly, without searching $PATH, so they're not relevant for a default $PATH search. Their real binaries are in /run/current-system/sw/bin. |
I marked this as stale due to inactivity. → More info |
Yet again, not stale. |
but not when nixpkgs is used in another Distro. I think it is save to add the new entry but not to remove the default entries.
It didn't get any attention in the last 6 months which is stale. That does not mean it is irrelevant. |
Surely another distro that uses nixpkgs would use their own libc and not NixOS's version of glibc. Besides, you cannot know for sure what the correct default directories on any other OS are. |
Nope, everything is linked against the libc in nixpkgs.
But |
Non nix-managed tools would most likely be linked agains an external libc. Do we have a way to query os ? I see Maybe add this variable in another PR and use it so on non nixos ok we keep impure path but on nixos we can safely remove them. |
Motivation for this change
The string returned by
confstr(_CS_PATH)
, which is also the output of the commandgetconf PATH
, contains a default path that is guaranteed to find (at least) all POSIX standard utilities. The current value is:There are two problems with this.
/bin
and/usr/bin
should be removed, as NixOS package management never puts anything there. Anything dropped in/bin
or/usr/bin
under the name of a standard utility would likely be bogus.The default profile binaries directory is not in it. This is a problem because the default NixOS installation lacks several mandatory standard POSIX utilities. The command recommended by the system's error message for a missing command to install a missing package foo is
nix-env -iA nixos.foo
. When this is done as root, the corresponding binaries are installed for all users in/nix/var/nix/profiles/default/bin
.Things done
pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
:CS_PATH
: Replace/bin:/usr/bin
fallback by default profile path/nix/var/nix/profiles/default/bin
.Fixes: #65512